Thread: Hide and Unhide
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Hide and Unhide

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
---------------
Jacob Skaria


"Ranjith Kurian" wrote:

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)