VBA Worksheets() term

A

abxy

Hi all,

Is there anyway I can reference all sheets in the workbook, or eithe
all sheets in between (sheets that i've named) "Top" and "Bottom" usin
the Worksheets() term in vba?

I know that i can use the Sheets(Array("Sheet1", "Sheet2", ...)) ter
but that's not gonna fly in this case cause the work book is update
daily and i can't reference specific sheets unless it's something lik
every sheet between "this sheet" to "that sheet".

Thx :
 
B

Bob Phillips

Dim i As Long
Dim ary

ReDim ary(Worksheets.Count - 1)
For i = 1 To Worksheets.Count
ary(i - 1) = Worksheets(i).Name
Next i
Worksheets(ary).Select


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top