macro to all worksheets

G

Gary''s Student

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.
 
D

Don Guillett

Sub allshts()
For Each ws In ActiveWorkbook.Sheets
MsgBox ws.Name
Next ws
End Sub
 

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

Top