Hi Suzzi,
I'm Michelle and I'd be glad to help you out with your query or concern.
Microsoft provides programming examples for illustration only, without ******** either expressed or implied. This includes, but is not limited to, the implied ********** of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To try the sample macro, follow these steps:
Type the following macro code into a new module sheet.
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
' Insert your code here.
' The following line shows how to reference a sheet within
' the loop by displaying the worksheet name in a dialog box.
MsgBox ActiveWorkbook.Worksheets(I). Name
Next I
End Sub
To run the macro, position the insertion point in the line that reads "Sub WorksheetLoop()," and press F5.
The macro will loop through the workbook and display a message box with a different worksheet name each time it runs through the loop. Note that this macro will only display
I hope this information helps you. If you have any questions, please do let me know and I'll be more than happy to assist you further with this.
If the answer is helpful, please click "Accept as Answer". Thank you and enjoy your day. :-)
Best Regards,
Michelle