Run Same VBA Macro Code On Multiple Sheets

[Closed]
Report
-
 Issa -
Hello,

I am trying to run the following code on multile sheets in a workbook. so far this code is working fine for one worksheet. Can someone help me to modify this so it runs on multiple sheets. There are 80 worksheet in a workbook. Thanks for the help in advance.

The idea of the code is to hide/unhide range of rows when click on the checkbox, I have three checkboxes, each one has different range of rows.

The Code is:

Private Sub CheckBox1_Click()

If CheckBox1 = False Then
Range("A51:W86").Select
Selection.EntireRow.Hidden = True

Else
Range("A51:W86").Select
Selection.EntireRow.Hidden = False
End If


End Sub
Private Sub CheckBox2_Click()
If CheckBox2 = False Then
Range("A87:W129").Select
Selection.EntireRow.Hidden = True

Else
Range("A87:W129").Select
Selection.EntireRow.Hidden = False
End If

End Sub
Private Sub CheckBox3_Click()
If CheckBox3 = False Then
Range("A130:W171").Select
Selection.EntireRow.Hidden = True

Else
Range("A130:W171").Select
Selection.EntireRow.Hidden = False
End If

End Sub


Thank you in advance for any help.

2 replies

Please some one help me
not answered yet