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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I find out which sheets that are selected 1

Status
Not open for further replies.

globalbear

IS-IT--Management
Dec 5, 2004
27
SE
I need to make a "for each sh in worksheets" loop in my code. The problem is I only want to loop the selected sheets.

All sheets that are not selected should not be affected in my for-each loop.

Say I have 5 sheets: Sheet1-Sheet5. Sheet2 and Sheet4 are selected by the user. Now, I want the for each-loop run only for Sheet2 & Sheet4 and not for Sheet1,Sheet3 or Sheet5.

How can I do this?

I noticed there is something called "activesheet.visible" which returns -1 if the sheet is visible. Is there something similar like "activesheet.selected" that I could use?
 
something like this ?
For Each sh In ActiveWorkbook.Windows(1).SelectedSheets

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV!

It seems to work. I knew there had to be some simple fix to this. I said it before and I say it again - this forum is great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top