Hello.. I'm trying to select all the excel worksheets via a visual basic macro. The only way I can see is using an array. This is great if I know the number and names of all the sheets ahead of time, but how do I fill this array without knowing that ahead of time?
Thanks, Stewart
Sat, 10 Apr 2004 05:02:48 GMT
Andr #2 / 2
Selecting multiple sheets in an Excel workbook
Even if you change the name of a worksheet excel remembers that it is Sheet(1), Sheet(2)... etc. Therefore I would use iNoSheets = Worksheets.Count to find the number of sheets. Then you can use a For i = 1 to iNoSheets to fill your array - refering to each sheeet just as Worksheet(i).
Regards, Andrew
Quote:
> Hello.. I'm trying to select all the excel worksheets via a visual > basic macro. The only way I can see is using an array. This is great > if I know the number and names of all the sheets ahead of time, but > how do I fill this array without knowing that ahead of time?