How to automate a macro to run on all sheets in a workbook

  • Thread starter Thread starter Maurice Roche
  • Start date Start date
M

Maurice Roche

Hello,

I know that this is probably really simple, but I am
trying the run a macro on all sheets in a workbook, there
are 60 sheets all of the same format and structure,
however i have to rearrange the structure, so I was hoping
that I can record a macro and then add some code so it
will run on all sheets?

Any help would be appreciated

Thanks

Maurice
 
Maurice,

Try structuring your code as the following:

Dim WS As Worksheet
For Each WS In Worksheets
' do something with WS
Next WS


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top