Excel Sheet Names

  • Thread starter Thread starter Leo
  • Start date Start date
L

Leo

Hi -

I am trying to write a code that allows me to add all
worksheet names into an array.

My array is defined as:
Dim SheetName (20) as String

I tried the following code but it doesn't seem to work:

For z = 1 to SheetCount

SheetName(z) = xlswb.Worksheets.Add

Next z

I am trying to look for a command that reads each 'tab' in
a workbook and 'sends' the name of each worksheet to my
array.

Please help.

Thanks
 
Change
SheetName(z) = xlswb.Worksheets.Add

to
SheetName(z) = xlswb.Worksheets(z).Name
 
Back
Top