Thread
:
Looping Problem . . .Argh!
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Looping Problem . . .Argh!
try this
Sub hideshts()
For Each ws In Worksheets
If ws.Range("a2") = "" Then ws.Visible = False
Next
End Sub
--
Don Guillett
SalesAid Software
"ed" wrote in message
...
I am using the following code to cycle through open sheets and hide those
with nothing in Cell A2. When I run the code, it never changes sheets, it
just applies the logic to the same sheet.
Dim SH As Worksheet
Dim xlRng As Object 'Excel.Range
Dim xlApp As Excel.Application
For Each SH In xlApp.ActiveWorkbook.Worksheets
Set xlRng = xlApp.Range("A2")
If xlRng = "" Then xlApp.ActiveWindow.SelectedSheets.Visible = False
Next SH
Any Ideas
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]