ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   macro to all worksheets (https://www.excelbanter.com/new-users-excel/177520-macro-all-worksheets.html)

[email protected]

macro to all worksheets
 
hi
how to apply a single macro to all worksheets????????

Gary''s Student

macro to all worksheets
 
Sub allsheets()
Dim w As Worksheet
For Each w In Worksheets
w.Range("A1").Value = 1
Next
End Sub
is an example of doing something on all the worksheets in a workbook.
--
Gary''s Student - gsnu2007d


" wrote:

hi
how to apply a single macro to all worksheets????????


Don Guillett

macro to all worksheets
 
Sub allshts()
For Each ws In ActiveWorkbook.Sheets
MsgBox ws.Name
Next ws
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
hi
how to apply a single macro to all worksheets????????




All times are GMT +1. The time now is 01:38 PM.

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