Link to home
Start Free TrialLog in
Avatar of Allen Prince
Allen PrinceFlag for United States of America

asked on

Check Excel worksheet tab name for text and hide the sheet

I want to check if a workbook contains a tab with the name work* IE: workarea or "work sheet"
and hide the sheets that are so named
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Allen Prince

ASKER

fantastic.
except...
it is case sensitive!
and...
if for some reason there are two sheets that have a tab name begining with "work" there is an error..
how to pose this question?
hmm...
Avatar of Norie
Norie

I can't see why having more than one sheet with the name beginning with 'work' would cause an error but what error is it causing?

As for the case thing, try this.
Dim ws As Worksheet
 
    For Each ws In ActiveWorkbook.Sheets
        If LCase(ws.Name) LIke "work*" Then
            ws.Visible = False
       End If
   Next ws

Open in new window

You are correct on both counts!  
I must have mistyped something .  
LCase works fine
Thanks