D
Darren Hill
The following code keeps failing on the last line, the one after On Error:
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case Left(ws.Name, InStr(ws.Name, "_"))
Case "GM_"
ws.Visible = xlSheetVisible
Case "Data_"
ws.Visible = xlSheetHidden
Case "VBA_"
ws.Visible = xlSheetVeryHidden
End Select
Next ws
On Error Resume Next
ThisWorkbook.Worksheets("Front Page").Select ' <<< - fails here
End Sub
If I don't have the On Error statement in there, it crashes with a
Runtime error '57121"
Application-defined or object-defined error
Darren
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case Left(ws.Name, InStr(ws.Name, "_"))
Case "GM_"
ws.Visible = xlSheetVisible
Case "Data_"
ws.Visible = xlSheetHidden
Case "VBA_"
ws.Visible = xlSheetVeryHidden
End Select
Next ws
On Error Resume Next
ThisWorkbook.Worksheets("Front Page").Select ' <<< - fails here
End Sub
If I don't have the On Error statement in there, it crashes with a
Runtime error '57121"
Application-defined or object-defined error
Darren