Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

travsersing visible sheets

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
is there a simpler alternative to

for each ws in worksheets
if ws.visible = true then ....
next

is there something sort of equivalent to

for each ws in worksheets.hidden
next

OR

for each ws.hidden in worksheets
next


thanks
 
The simple anser is "no".

The [tt]For Each[/tt] statement works on collections and there is no collection of hidden sheets (i.e., [tt]Worksheets.Hidden[/tt] is not a collection). The "loop variable" is assigned, in turn to each element in the collection (i.e., [tt]ws.Hidden[/tt] is not a variable that you can assign members to).

Your first code fragment is the simplest method.

[tt]________________________________________________________________
[pc2]Roger
Life is a game of cards in which the deck contains only jokers.[/tt]
 
oh ok i needed to be reminded that the loop works on collections, thanks
 
i guess NO is the same answer for the other thread i posted today where i wanted to know if i could traverse just the comments of one column, but i guess i can only do that for a whole worksheet, thanks
 
Yeah - comments are a bit wierd - the collection belongs to the worksheet but the comment object itself belongs to a range so you can't reference comments in a specific range but you add them to a specific range

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Luis
Can't you use the cod that I posted?
Code:
    For Each com In Comments
        If com.Parent.Column = 3 Then
        'stuff to do with comments in col C
           
        End If
    Next
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top