Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hide/sheets using a macro

I would like a macro which will hide and unhide sheets. I will attached the macro to a button.

Thanks

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

1. In your docuument, define a variable named "vShowSheet" and assign it a value of "1".

2. On the properties General tab for the sheet(s) you want hide, in the Show Sheet section:
- check Conditional
- Enter "vShowSheet" for the Condition (without the quotes).

3. If you are using V9+, assign Action to the button:
Action: Set Variable
Variable: vShowSheet
Value: =(vShowSheet-1)*-1

That Value expression will toggle the variable value between 0 and 1.

3 If you are using V8, define a macro like this:
Sub ToggleShow
ActiveDocument.GetVariable("vShowSheet").SetContent ActiveDocument.Evaluate("(vShowSheet-1)*-1"), true
End Sub

Then assign the macro ToggleShow to your button.

-Rob

View solution in original post

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

1. In your docuument, define a variable named "vShowSheet" and assign it a value of "1".

2. On the properties General tab for the sheet(s) you want hide, in the Show Sheet section:
- check Conditional
- Enter "vShowSheet" for the Condition (without the quotes).

3. If you are using V9+, assign Action to the button:
Action: Set Variable
Variable: vShowSheet
Value: =(vShowSheet-1)*-1

That Value expression will toggle the variable value between 0 and 1.

3 If you are using V8, define a macro like this:
Sub ToggleShow
ActiveDocument.GetVariable("vShowSheet").SetContent ActiveDocument.Evaluate("(vShowSheet-1)*-1"), true
End Sub

Then assign the macro ToggleShow to your button.

-Rob

Not applicable
Author

Hi Rob,

how can i make , not having connections between one sheet to another sheet. Here in two sheets i am using same objects and expressions. If i am changing any positions or values of particular object, it should not get effected with another sheet.

First Sheet is "G1" contains slider and barchart based on slider movements the barchart changes.

Second Sheet is "G2" contains the same objects , slider and barchart based on slider movements the barchart changes.

Now my requirement is when i am working with "G1" and making changes that should not be effect to "G2". Totally i don't want any relationship between this two sheets.

Can you help in this query.

Thnks

Not applicable
Author

Hi Rob

I am trying to put a button on my QV9 document that shows and selects a sheet ( otherwise the sheet is hidden) and then hides it .

I have put the following

In the script I have put the following,

SET

vShowSheet = 1;

(I have also tried Let vShowSheet = 1)

then on the sheet I wish the action to happen on, set Show sheet to conditional and put the condition as

vShowSheet

On the button I have selected tab Actions>Set variable and Variable as

vShowSheet  and condition as

=(vShowSheet-1)*-1

This does not seem to be working as when I click the button nothing happens ,

Can you please help me ?

Thanks

A

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should not have parens in

=(vShowSheet-1)*-1

it should be:

=vShowSheet-1*-1

An even easier way to toggle the variable is:

=NOT vShowSheet

-Rob

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

@satish47.venkat

So you want selections to be independent on each sheet? See http://community.qlik.com/message/102195#102195

Not applicable
Author

Hi Rob

Thanks a mill it works perfect

Kind regards


Anne