Run Same VBA Macro Code On Multiple Sheets

Closed
issa - Aug 27, 2010 at 01:26 PM
 Issa - Aug 31, 2010 at 10:35 AM
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.
Related:

2 responses

Please some one help me
0
not answered yet
0