PDA

View Full Version : Solved: wildcard use with xlSheetVeryHidden ?



bdsii
03-01-2010, 08:45 AM
All - I have a series of worksheets that begin with the same 7 characters of "Budget-" followed by their month and year making up the worksheet name.

I would like to use xlSheetVeryHidden for them but do not want to have to call each one out specifically each time a new one is added.

I want to convert the code below to one that will hide any worksheet beginning with "Budget-". This is similar to a wildcard being used in the sheet name.

Worksheets("Budget-Jan2010").Visible = xlSheetVeryHidden


I played around with adding in some fashion the code below to the xlSheetVeryHidden command but could not get it to work.

Left$(wk.Name, 7) <> "Budget-"


Any ideas how to accomplish this ? Can a wildcard be used in this command or would the Left$ function be needed ?

thanks !

Bob Phillips
03-01-2010, 08:50 AM
One idea


For Each sh In Activeworkbook.Worksheets

If sh.Name Like "Budget-*" Then

sh.Visible = xlSheetVeryHidden
End If
Next sh

bdsii
03-01-2010, 11:55 AM
Yep, that does it....thanks XLD ! :clap: