MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Selecting Worksheets

Posted by Dave on December 04, 2001 3:34 AM

I'm trying to write a macro that will perform an operation on each worksheet in a workbook in turn but without having to enter the name of each individual sheet into the formula.

Does anyone have any suggestions as to how to do this?


Posted by Bib on December 04, 2001 4:15 AM


Try this :

Sub MySub()
Dim i as Integer
For i = 1 to ActiveWorkbook.Sheets.Count
'Your code here
End Sub

Posted by Dave on December 04, 2001 4:44 AM


That works a treat.

Thanks again