View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default need some help with selecting a sheet in a loop again

Hi Gary,

Change:

For c = 3 To ActiveWorkbook.Sheets.Count


to:

For c = 2 To 13


I forgot to amend my test code!

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary,

Try something like:

Sub TestIt()
Dim c As Long
Dim sh As Worksheet
For c = 3 To ActiveWorkbook.Sheets.Count
For Each sh In ActiveWorkbook.Worksheets
If sh.CodeName = "Sheet" & c Then
'do something. e.g.:
MsgBox sh.Name
End If
Next sh
Next c

End Sub

---
Regards,
Norman