View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CM4@FL[_2_] CM4@FL[_2_] is offline
external usenet poster
 
Posts: 12
Default VBA: Activate sheets within a loop

I want to loop through a list of sheets, why won't the following code allow
me to activate a sheet? Thanks for your help in advance!

Sub LoopThroughSheets()

Dim wSheet As Worksheet

i = 5
wSheet = Sheets("Print Tracks").Range("G" & i).Value

Do While wSheet < ""

Sheets(wSheet).Activate
Calculate

i = i + 1
wSheet = Sheets("Print Tracks").Range("G" & i).Value

Loop

End Sub