View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin Beckham Kevin Beckham is offline
external usenet poster
 
Posts: 78
Default Another loop & sheet question

After the Sheet.Add put
If aaa= 1 And wksh = 5 Then 'or whenever
strSheetName = Activesheet.Name
End If

then refer to the sheet as
Sheets(strSheetName)

or set a variable, e.g.
Set sheet5 = Activesheet

then use this object
Sheet5.

Kevin Beckham

-----Original Message-----

Say I have something simple like the code below:

for aaa = 1 To 2
For wksh = 1 To 5
Sheets.Add

...
' change active sheets in here
...
' Now I might want to go back to fifth sheet created
Next wksh
Next aaa
.... more code
' again, I may want to go back to the fifth sheet created
.... more code


The program above creates 10 sheets. I need to go back
later to some of the sheets (say I know I want to go back
to worksheet 5). How can I select that particular sheet
(either in the loop or after I am out of the loop)? I
can't say sheet(5) select, because there may have been
more sheets created before these loops were run.

How can I do something in this to make these sheets
identifiable so I can update them later in the code.

Thanks

Steve
.