View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro fundamentals

I started with Tom's suggested code:

Sub visible_sheets()
Dim sht As Worksheet
worksheets("policy information").visible = xlsheetvisible
For Each sht In Worksheets
If lcase(sht.Name) < "policy information" Then
Sht.Visible = False
End If
Next
End Sub

If you're unlucky, "policy information" could be hidden and you could end up
with an error--since at least one sheet needs to be visible.



Brad wrote:

I have a worksheet that I want to hide all the tabs other than "Policy
information"
What is wrong with the below code. The macro doesn't seem to recognize the
line

If sheet.Name < "Policy information" Then

correctly

Sub visible_sheets()
Dim sheet As Worksheet
For Each sheet In Worksheets
If sheet.Name < "Policy information" Then
Sheets.Visible = False
End If
Next
End Sub


--

Dave Peterson