JaredSorensen
Board Regular
- Joined
- Aug 23, 2007
- Messages
- 160
I have a workbook that I want to run a macro on for each of the selected tabs. Could you please advise me regarding how I can cycle through multiple tabs that are selected prior to initiating the macro? I have the code down for what I need to do on each tab, but need this outer piece.
Please assume I have a tabs Sheet1, Sheet2, and Sheet3 selected.
This is the code I see when I select them all:
This is the generic code for advancing to the next tab; I would prefer something more sophisticated than this--even a formal loop.
Ideally, I'd like to use the For Each . . . Next construct, if someone knows how that could be used. Thank you very much!
Jared
Please assume I have a tabs Sheet1, Sheet2, and Sheet3 selected.
This is the code I see when I select them all:
Code:
Sheets(Array("renamed", "Sheet1", "Sheet2", "Sheet3")).Select
This is the generic code for advancing to the next tab; I would prefer something more sophisticated than this--even a formal loop.
Code:
ActiveSheet.Previous.Select
Ideally, I'd like to use the For Each . . . Next construct, if someone knows how that could be used. Thank you very much!
Jared