ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Running macros on ALL Excel tabs (https://www.excelbanter.com/excel-worksheet-functions/92766-running-macros-all-excel-tabs.html)

tbong

Running macros on ALL Excel tabs
 
Can I create a Macro and have it run on all tabs in the Excel workbook?

I have tried to do this by creating a macro and within the macro move from
tab to tab. When I then run the macro, Excel promps me to debug at the very
point that is should move onto the next tab.
The macro itself is a simple one and only includes formatting, sorting, &
subtotaling commands.
The problem is I have 30+ reports each with 15+ tabs and need this macro to
run on all tabs.... a very time consuming task if I have to run it tab by tab.

Any help would be greatly appreciated!

Otto Moehrbach

Running macros on ALL Excel tabs
 
Something like this maybe:
Sub DoThisEachSht()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
'Your code goes here
Next ws
End Sub
"tbong" wrote in message
...
Can I create a Macro and have it run on all tabs in the Excel workbook?

I have tried to do this by creating a macro and within the macro move from
tab to tab. When I then run the macro, Excel promps me to debug at the
very
point that is should move onto the next tab.
The macro itself is a simple one and only includes formatting, sorting, &
subtotaling commands.
The problem is I have 30+ reports each with 15+ tabs and need this macro
to
run on all tabs.... a very time consuming task if I have to run it tab by
tab.

Any help would be greatly appreciated!





All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com