John Carney
asked on
Unhiding and deleting multiple sheets based on their names
I get a type mismatch error on line 3 in the code below. What is the proper way to write that line?
Thanks,
John
Thanks,
John
Sub RemoveSheets()
Dim i As Long, ws As Worksheet
For i = 1 To ActiveWorkbook.Worksheets.Count
If Worksheets(i).Name = "ACV" Or "B773i4" Or "JETZ" Or "LEGACY" Then
Worksheets(i).Visible = True
Worksheets(i).Delete
End If
Next
End Sub
I think if you Dim i as Integer?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Unless you need to know the sheet number, it would be better to loop over the worksheets collection.
dim ws as worksheet
for each ws in worksheets
if ws.name = "ACV" then
...
end if
next ws
ASKER
I could swear I tried exactly what you posted, but obviously not exactly :-) Thanks, SantaBaby.
- John
- John