Toggle Hide/Show
-----Original Message-----
Greetings,
I would like button that the first time its clicked, will
hide columns C:G and when clicked the next time will show
the same columns. I can write the code to separately hide
or show but I dont know how to combine them to toggle when
the button is clicked.
All help is greatly appreciated!
Alan
.
Alan
This will do. Right click the sheet tab and select View
Code. Paste the following macro then assign it to a button.
Sub ToggleHidden()
Dim rng As Range
Set rng = Range(Cells(1, 3), Cells(1, 7))
rng.EntireColumn.Hidden = rng.EntireColumn.Hidden = False
End Sub
Regards
Peter
|