group sheets with macro in excel

J

jannkatt

Is there a way to easily group worksheets in excel using a macro so that some
function can be performed on all sheets at the same time? I have over 100
sheets and currently have to list each sheet in the macro. This is time
consuming since the sheet names change every year.

Thanks.
 
B

Bob Phillips

Worksheets(Array("Sheet1", "Sheet2")).Select


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
M

Miguel Zapico

You may use the Worksheets collection, and loop through it. Something like:

Dim wksPage As Worksheet
For Each wksPage In ActiveWorkbook.Worksheets
'Here you can do whatever you need with the wksPage object
Next

Hope this helps,
Miguel.
 
Top