Move through the sheets of a workbook

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

What is the code to move through the sheets of a workbook one by one and
after processing the last sheet, stop?

Thanks!

Steve
 
What is the code to move through the sheets of a workbook one
by one and after processing the last sheet, stop?

Here is one way...

Sub TestCode3()
Dim WS As Worksheet
For Each WS In Worksheets
' Your code goes here in
' place of the following
WS.Range("A1") = WS.Name
Next
End Sub


Rick
 
Thanks, Rick!

Steve


Rick Rothstein (MVP - VB) said:
Here is one way...

Sub TestCode3()
Dim WS As Worksheet
For Each WS In Worksheets
' Your code goes here in
' place of the following
WS.Range("A1") = WS.Name
Next
End Sub


Rick
 

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