MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Worksheet Names


Posted by Daniel on January 09, 2002 5:25 PM

I would like to know how to retrieve the Worksheet names from a workbook via Visual Baisc.

Does anyone know how? I havn't had much help going to visual baisc sites but I'm hoping someone here has had experience with it!

PLEASE HELP!


Posted by Jacob on January 09, 2002 5:46 PM

Hi

I use these alot
Dim MyName

MyName = ativesheet.name
or
MyName = sheets(1).name

Do these do what you want?

HTH

Jacob

Posted by sandra on January 10, 2002 8:20 AM

You can try the following macro

Sub RetrieveNames()

Sheets.Add
ActiveSheet.Name = "ListName" ' optional
i = 0
For Each n In ActiveWorkbook.Names
i = i + 1
Cells(i, 1) = n.Name & " " & n.RefersTo

Next n

End Sub