Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Putting the loop variable after the next makes it easier to see where the
loop begins and ends. Using worksheet as a variable probably isn't the best of ideas. Declaring your variable is good, so teh second is probably perferred. -- Regards, Tom Ogilvy "Fredg" wrote in message ... Also, of the two blocks of codes which would be the most correct, both work the same way. I would think the second one, but I can not explain WHY it would be better. ----- Sub countsheets() For Each Worksheet In ActiveWorkbook.Worksheets MsgBox Worksheet.Name Next End Sub ----- Sub countsheets() Dim Item as WorkSheet For Each Item In ActiveWorkbook.Worksheets MsgBox Item.Name Next Item End Sub -- Fredg ------------------------------------------------------------------------ Fredg's Profile: http://www.excelforum.com/member.php...o&userid=26328 View this thread: http://www.excelforum.com/showthread...hreadid=466757 |
Thread Tools | Search this Thread |
Display Modes | |
|
|