steveh1983
New Member
- Joined
- Feb 18, 2016
- Messages
- 4
Hi Guys,
Trying to run the below code but is falling over at wsh.Select F. The code seems to work in a different workbook I have (smaller file) but comes up with run time error now.
Code
Dim wsh As Worksheet
Dim f As Boolean
f = True
For Each wsh In Worksheets
Select Case wsh.Name
' List the exceptions here
Case "Contract Extract", "Tree", "Total Region", "Start", "BOB", "ESA", "ESB", "LNA", "LNB", "LNC", "LND", "LNG", "LNH", _
"LNN", "LNO", "LNP", "LNQ", "LNR", "LNS", "LNT", "LNV", "LNW", "LNX", "LNY", "LNZ", "RAA", _
"SHA", "SHB", "SKA", "SKB", "SKC", "SKD", "SKO", "End"
' Skip these
Case Else
wsh.Select f
f = False
End Select
Next wsh
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Trying to run the below code but is falling over at wsh.Select F. The code seems to work in a different workbook I have (smaller file) but comes up with run time error now.
Code
Dim wsh As Worksheet
Dim f As Boolean
f = True
For Each wsh In Worksheets
Select Case wsh.Name
' List the exceptions here
Case "Contract Extract", "Tree", "Total Region", "Start", "BOB", "ESA", "ESB", "LNA", "LNB", "LNC", "LND", "LNG", "LNH", _
"LNN", "LNO", "LNP", "LNQ", "LNR", "LNS", "LNT", "LNV", "LNW", "LNX", "LNY", "LNZ", "RAA", _
"SHA", "SHB", "SKA", "SKB", "SKC", "SKD", "SKO", "End"
' Skip these
Case Else
wsh.Select f
f = False
End Select
Next wsh
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True