lonlyboy
New Member
- Joined
- Feb 16, 2010
- Messages
- 25
- Office Version
- 365
- Platform
- Windows
I have the code listed below working on a 'per worksheet' basis. I need to create multiple sheets and would like to use the same code across sheets. Instead of copying/pasting the same code into each sheet, I would like to make it workbook wide but run on the active sheet. I started playing with the first couple lines but it's not working. I'm sure that I'm just missing something simple in this code.
If ActiveSheet.Range(ActiveSheet.Cells("A1")) = "SELECT" Then
ActiveSheet.Rows("2:31").EntireRow.Hidden = True
End If
If Worksheet.Range("A1") = "Panel 1" Then
Application.Rows("2:12").EntireRow.Hidden = False
Application.Rows("13:31").EntireRow.Hidden = True
End If
If Range("A1") = "Panel 2" Then
Rows("2:12").EntireRow.Hidden = True
Rows("13:24").EntireRow.Hidden = False
Rows("25:31").EntireRow.Hidden = True
End If
If Range("A1") = "Panel 3" Then
Rows("2:24").EntireRow.Hidden = True
Rows("25:31").EntireRow.Hidden = False
End If
End Sub
If ActiveSheet.Range(ActiveSheet.Cells("A1")) = "SELECT" Then
ActiveSheet.Rows("2:31").EntireRow.Hidden = True
End If
If Worksheet.Range("A1") = "Panel 1" Then
Application.Rows("2:12").EntireRow.Hidden = False
Application.Rows("13:31").EntireRow.Hidden = True
End If
If Range("A1") = "Panel 2" Then
Rows("2:12").EntireRow.Hidden = True
Rows("13:24").EntireRow.Hidden = False
Rows("25:31").EntireRow.Hidden = True
End If
If Range("A1") = "Panel 3" Then
Rows("2:24").EntireRow.Hidden = True
Rows("25:31").EntireRow.Hidden = False
End If
End Sub