ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Worksheets() term (https://www.excelbanter.com/excel-programming/297615-vba-worksheets-term.html)

abxy[_59_]

VBA Worksheets() term
 
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 :

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

VBA Worksheets() term
 
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)

"abxy " wrote in message
...
Hi all,

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

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

Thx :)


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com