View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Location for registering all the Worksheet names of a workbook

And in B3:

Sub SheetList()
dim i as long
for i = 1 to worksheets.count
activesheet.cells(i+2,"B").value = "'" & worksheets(i).name
next i
end sub

Sometimes plopping the worksheet name into a cell isn't enough. You'll want to
stop excel from parsing the entry. The "'" will treat the cell's value as text.

It would affect worksheets with names like:
000001
January 1, 2007
1.120000



Fanny wrote:

Dear Helpers,

I need to extract all the worksheet names in a summary worksheet. I copied
the following VBA from the Office Discussion Groups Q & A

Quote

Sub SheetList()
For Each ws In Worksheets
i = i + 1
Cells(i, 1) = ws.Name
Next
End Sub €“ by Mr Raypayette

Unquoted

The above vba works well but always have the result located at A1. Is it
possible to put it to B3 or any designated cell I choose.

Thanks in advance

Fanny

"raypayette" wrote:


You would have to use VBE:
Sub SheetList()
For Each ws In Worksheets
i = i + 1
Cells(i, 1) = ws.Name
Next
End Sub


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566968



--

Dave Peterson