Activex command to Hide/Unhide

S

Scafidel

I want a toggle button to Hide several rows of Nonessential information. I
can get it to hide the rows, but not unhide or unhide but not hide, but not
both. This is my first try with Activex. I am using this:
Private Sub ToggleButton1_Click()
Worksheets ("34-01") .Rows ("45:200") .Hidden = True
End Sub

That will hide the rows, but I have yet to come up with a command to toggle
hide/unhide.
Thanks
Scafidel
 
G

Gord Dibben

Private Sub ToggleButton1_Click()
With Worksheets("34-01").Rows("45:200")
If .Hidden = True Then
.Hidden = False
Else
.Hidden = True
End If
End With
End Sub


Gord Dibben MS Excel MVP
 
S

Scafidel

Thanks, Gord, you make it look simple!
Scafidel

Gord Dibben said:
Private Sub ToggleButton1_Click()
With Worksheets("34-01").Rows("45:200")
If .Hidden = True Then
.Hidden = False
Else
.Hidden = True
End If
End With
End Sub


Gord Dibben MS Excel MVP
 

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