2003 macros

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

I have a work book with 4 sheets...while each sheet receives updated data
regularly...the fields in each sheet are identical. Is there a way to run
a workbook macro on all sheets at once ? I can only figure out how to run
the macro on each sheet separately "?

Thanks, Tim R
 
You can't really run a macro on all sheets "all at once" (whatever that
might mean), but you can certainly write code that will run for each sheet
sequentially:

Sub AAA()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
' do something with the WS worksheet
Next WS
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
You can loop through the sheets using one macro.


Dim wkbktodo As Workbook
Dim ws As Worksheet
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
'do your stuff
Next ws


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top