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!

Loop through user selection.... 1

Status
Not open for further replies.

Johnny42

Technical User
Jul 13, 2004
127
CA
How would I loop through a user selection....
I use this , however the sheet must be the active one.....


For Each cell In Selection.Rows
'do.....
Next Cell

I would like something like this ..
For Each cell In Sheet("usersection").Selection.Rows
'do.....
Next Cell
 
Hi,

Isn't it the ActiveSheet that the user is selecting cells in???

The Selection Object is not available on anything but the ActiveSheet

You could have set a reference when the selection was made on the other sheet and then use that range reeference
Code:
'we're on Sheet1
set rng = selection
sheets("Sheet2").activate
for each c in rng.rows
  '
next


Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Thanks Skip,
Yes the user would be on the active sheet, however I like things a bullet proof as possible....:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top