Hide and Unhide

R

Ranjith Kurian

In my excel workbook i hv created two command buttons one is S and the other
is I
I need a code so that when i click on S button it should unhide few
sheets(X, Y, Z are the three sheets) and again second time when i click the
same S button it should hide the visible sheet(X,Y,Z)
Same way for button I, when i click on I button it should unhide few
sheets(E,F,G are the three sheets) and again second time when i click the
same I button it should hide the visible sheet(E,F,G)
 
J

Jacob Skaria

Dear Ranjith

Use the IIF function

Sheets("X").Visible= IIf(Sheets("X").Visible,false,true)
Sheets("Y").Visible= IIf(Sheets("Y").Visible,false,true)
Sheets("Z").Visible= IIf(Sheets("Z").Visible,false,true)

If this post helps click Yes
 
J

Jacob Skaria

OR

Sheets("X").Visible= not Sheets("X").Visible
Sheets("Y").Visible= not Sheets("Y").Visible
Sheets("Z").Visible= not Sheets("Z").Visible
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top