Problems with vb.veryhidden
Try:
Sub HideSheets()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If Not LCase(wks.Name) Like "*competition*" _
And Not wks.Name Like "Regional*" Then _
wks.Visible = xlSheetVeryHidden
Next wks
End Sub
Regards,
Greg
-----Original Message-----
Please help!
I am trying to very hide every worksheet in this workbook
except for 3- one called RegionalControl, RegionalHelp,
and one containing the word competition. Every time the
code executes, it tells me it is unable to set the visible
property. Here is my code:
Dim curwkbk As Workbook
Set curwkbk = ThisWorkbook
Dim wks As Worksheet
Dim wksname As String
For Each wks In curwkbk.Worksheets
wksname = wks.Name
If LCase(wks.Name) Like "*total*" Then
Worksheets(wksname).Visible = xlSheetVeryHidden
ElseIf LCase(wks.Name) Like "*Competition*" Then
'nothing
ElseIf wks.Name = "RegionalControl" Then
'nothing
ElseIf wks.Name = "RegionalHelp" Then
'nothing
Else
Worksheets(wksname).Visible = xlSheetVeryHidden
End If
Next wks
Thanks for any help you can give me!
.
|