give this a try
create a button and leave the control name as CommandButton1
Sub Toggle()
Dim rRange As Range
Dim rCell As Range
Dim lRow As Long
Application.ScreenUpdating = False
Set rRange = Range("G9:G125")
For Each rCell In rRange
If rCell = 0 And Sheet1.CommandButton1.Caption = "Hide" Then
rCell.EntireRow.Hidden = True
Else
rCell.EntireRow.Hidden = False
End If
Next rCell
If Sheet1.CommandButton1.Caption = "Hide" Then
Sheet1.CommandButton1.Caption = "Show"
Else
Sheet1.CommandButton1.Caption = "Hide"
End If
Application.ScreenUpdating = True
End Sub
by the way, first time you run it, probably "won't" do anything, the second click will actually trigger the macro correctly. This is because your button caption may not be setup properly, unless you edit the button first...