kelsonbaird
New Member
- Joined
- Oct 14, 2019
- Messages
- 9
So, I think that I see what the issue is but coming up blank with a work around. I THINK the issue is that I am trying to hide the sheet that I am on before moving to the next, but not sure how to make it work.
Basically, I want to automatically hide sheets that start with the word "Vacant" or start with "Aug" and keep any other sheet visible. here's what I have tried. It keeps getting caught up on the second to last line ("wsCurrent.Visible = False"):
Sub Sheet_hide()
Dim wsCurrent As Worksheet
For Each wsCurrent In ActiveWorkbook.Worksheets
If Left(wsCurrent.Name, 6) = "Vacant" Then
GoTo Hide
Else
GoTo Continue
End If
Continue:
If Left(wsCurrent.Name, 3) = "Aug" Then
GoTo Hide
Else
GoTo Skip
End If
Skip:
wsCurrent.Visible = True
Hide:
wsCurrent.Visible = False
Next wsCurrent
End Sub
Basically, I want to automatically hide sheets that start with the word "Vacant" or start with "Aug" and keep any other sheet visible. here's what I have tried. It keeps getting caught up on the second to last line ("wsCurrent.Visible = False"):
Sub Sheet_hide()
Dim wsCurrent As Worksheet
For Each wsCurrent In ActiveWorkbook.Worksheets
If Left(wsCurrent.Name, 6) = "Vacant" Then
GoTo Hide
Else
GoTo Continue
End If
Continue:
If Left(wsCurrent.Name, 3) = "Aug" Then
GoTo Hide
Else
GoTo Skip
End If
Skip:
wsCurrent.Visible = True
Hide:
wsCurrent.Visible = False
Next wsCurrent
End Sub