Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default Specific location to register the worksheet names of a workbook

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:

Click to show or hide original message or reply text.



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



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Specific location to register the worksheet names of a workbook

Sub SheetList()
i = 0
Set r = Range(Application.InputBox(prompt:="enter start cell:", Type:=2))
For Each ws In Worksheets
r.Offset(i, 0) = ws.Name
i = i + 1
Next
End Sub

run the sub and supply the address
--
Gary''s Student - gsnu200746


"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:

Click to show or hide original message or reply text.



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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Specific location to register the worksheet names of a workbook

I bet you meant type:=8.

Gary''s Student wrote:

Sub SheetList()
i = 0
Set r = Range(Application.InputBox(prompt:="enter start cell:", Type:=2))
For Each ws In Worksheets
r.Offset(i, 0) = ws.Name
i = i + 1
Next
End Sub

run the sub and supply the address
--
Gary''s Student - gsnu200746

"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:

Click to show or hide original message or reply text.



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
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Specific location to register the worksheet names of a workboo

Hi Dave:

By habit, I usually get addresses as a string and then convert it to a
range. It's a habit I should break.
--
Gary''s Student - gsnu200746


"Dave Peterson" wrote:

I bet you meant type:=8.

Gary''s Student wrote:

Sub SheetList()
i = 0
Set r = Range(Application.InputBox(prompt:="enter start cell:", Type:=2))
For Each ws In Worksheets
r.Offset(i, 0) = ws.Name
i = i + 1
Next
End Sub

run the sub and supply the address
--
Gary''s Student - gsnu200746

"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:

Click to show or hide original message or reply text.



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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Specific location to register the worksheet names of a workbook

Another version:

Option Explicit
Sub SheetList()

Dim i As Long
Dim DestCell As Range

Set DestCell = Nothing
On Error Resume Next
Set DestCell = Application.InputBox(PRompt:="Pick a cell", Type:=8)
On Error GoTo 0

If DestCell Is Nothing Then
'do nothing, user hit cancel
Else
For i = 1 To Worksheets.Count
DestCell.Value = "'" & Worksheets(i).Name
Set DestCell = DestCell.Offset(1, 0)
Next i
End If

End Sub



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:

Click to show or hide original message or reply text.


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


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default Specific location to register the worksheet names of a workboo

Dear Mr Dave Peterson,

Your solution worsk perfect. Thank you a lot.

Fanny

"Dave Peterson" wrote:

Another version:

Option Explicit
Sub SheetList()

Dim i As Long
Dim DestCell As Range

Set DestCell = Nothing
On Error Resume Next
Set DestCell = Application.InputBox(PRompt:="Pick a cell", Type:=8)
On Error GoTo 0

If DestCell Is Nothing Then
'do nothing, user hit cancel
Else
For i = 1 To Worksheets.Count
DestCell.Value = "'" & Worksheets(i).Name
Set DestCell = DestCell.Offset(1, 0)
Next i
End If

End Sub



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:

Click to show or hide original message or reply text.


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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Workbook to Specific Worksheet? Steven Hilgendorf Excel Discussion (Misc queries) 14 June 27th 07 12:22 AM
How to open a workbook on a specific worksheet. kevincanuk Excel Worksheet Functions 2 September 26th 06 02:21 PM
Copy Data from Workbook into specific Worksheet in other Workbook? kingdt Excel Discussion (Misc queries) 1 March 16th 06 06:55 PM
Defining non worksheet specific names... Steve Excel Worksheet Functions 0 June 29th 05 05:30 AM
Open workbook to specific worksheet Dave Excel Discussion (Misc queries) 2 May 2nd 05 08:44 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ฉ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"