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?

Thanks


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


Hello,

Try this :

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

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

Cheers,

That works a treat.

Thanks again