View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default Load an array with Sheet names

I am not too sure why you would like to load an array with the sheet names.
The sheets are a collection and the names can be accessed with a for next
loop.

dim wks as worksheet

for each wks in worksheets
msgbox wks.name
next wks

If you still need the array you can populate it from within the loop... but
I am not sure that it is necessary.

HTH

"S G Booth" wrote:

varr is a Variant array. I wish to load it with names of sheets in the
activeworkbook.
I have:

If Global_PrintAllBooks_Sheets = True Then
ReDim varr(1 To Worksheets.Count)
For i = 1 To UBound(varr)
varr(i) = ws.Name
i = i + 1
Next

I receive run time error 91 (Object variable or With block variable not set)
on varr(i) = ws.Name

Why is this please?

Regards.