Thread
:
Loop through all sheets in workbook
View Single Post
#
8
Posted to microsoft.public.excel.programming
Tushar Mehta
external usenet poster
Posts: 1,071
Loop through all sheets in workbook
No need to select objects.
If you use Worksheets.Count in the loop control statement, use the same
in the body of the loop.
Private Sub Workbook_Open()
Dim i As Long
For i = 1 To Worksheets.Count
Worksheets(i).Range("A1").Value = "Hello"
Next i
End Sub
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
I think you want to do this
Private Sub Workbook_Open()
Dim i As Long
For i = 1 To Worksheets.Count
Sheets(i).select
Range("A1").Value = "Hello"
Next i
End Sub
--
Kaak
------------------------------------------------------------------------
Kaak's Profile:
http://www.excelforum.com/member.php...fo&userid=7513
View this thread:
http://www.excelforum.com/showthread...hreadid=479367
Reply With Quote
Tushar Mehta
View Public Profile
Find all posts by Tushar Mehta