View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Using Worksheet Code Names

If wksSheet.Name < wksAdmin.Name Then
wksSheet.Visible = False
End If

You need apples and apples.



"Jake" wrote:

Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. The following code produces error message: object does not
support this property or method. I know i'm referencing wksAdmin
incorrectly, but not sure why. thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet < wksAdmin Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub