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

Creating a collection of sheets in Excel

Status
Not open for further replies.

Lippershey

Technical User
Jul 3, 2001
2
GB
Hi

Does anybody know if it is possible to create a collection of several selected worksheets in VBA for Excel, so that a loop can be created to perform a procedure for each member (ie sheet) in the collection. I hope that makes sense!

Cheers,
Paul.
 
If you want to loop through sheets that have been selected:

Sub Test()
Dim sh As Worksheet
For Each sh In Workbooks("WKBookName.xls").Windows(1).SelectedSheets
MsgBox sh.Name
Next sh
End Sub

IS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top