![]() |
Hide and Unhide
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) |
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) |
Hide and Unhide
OR
Sheets("X").Visible= not Sheets("X").Visible Sheets("Y").Visible= not Sheets("Y").Visible Sheets("Z").Visible= not Sheets("Z").Visible -- If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: 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) |
Hide and Unhide
Did that help or am I missing something?
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) |
All times are GMT +1. The time now is 05:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com