Excel 2007
Hi All,
I am trying to figure out how to loop through all worksheets in an open excel workbook.
I am trying something basic at first and after many attempts from samples on the net, I just can't figure out why it's not working for me.
Here is a basic attempt:
I do not understand why it's not looping. It only put's in the value (1) in the active sheet, but not the others in the workbook.
Any assistance will be greatly appreciated.
Michael
Hi All,
I am trying to figure out how to loop through all worksheets in an open excel workbook.
I am trying something basic at first and after many attempts from samples on the net, I just can't figure out why it's not working for me.
Here is a basic attempt:
Code:
Sub mloop()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
Range("A1").Value = 1
Next wSheet
End Sub
I do not understand why it's not looping. It only put's in the value (1) in the active sheet, but not the others in the workbook.
Any assistance will be greatly appreciated.
Michael