Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Need Macro to Collect Multiple Worksheet Names

I need a macro to collect the names of every worksheet in a workbook such
that the names are in adjacent cells in one worksheet. The number of
worksheets can vary and ideally I don't want to collect the names of the last
2 sheets but I can always just delete them manually.

B3 = sheet1 name
B4 = sheet2 name
B5 = sheet 3 name and so on

Thx.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Need Macro to Collect Multiple Worksheet Names

Run this sub in a new sheet (it'll list all sheetnames),
then just delete whatever is not required

Sub ListSheetNames()
Dim wkSht As Worksheet
Range("B2").Select
For Each wkSht In Worksheets
Selection = wkSht.Name
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Next wkSht
End Sub

--
Max
Singapore
---
"navel151" wrote:
I need a macro to collect the names of every worksheet in a workbook such
that the names are in adjacent cells in one worksheet. The number of
worksheets can vary and ideally I don't want to collect the names of the last
2 sheets but I can always just delete them manually.

B3 = sheet1 name
B4 = sheet2 name
B5 = sheet 3 name and so on


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Need Macro to Collect Multiple Worksheet Names

TY :)

"Max" wrote:

Run this sub in a new sheet (it'll list all sheetnames),
then just delete whatever is not required

Sub ListSheetNames()
Dim wkSht As Worksheet
Range("B2").Select
For Each wkSht In Worksheets
Selection = wkSht.Name
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Next wkSht
End Sub

--
Max
Singapore
---
"navel151" wrote:
I need a macro to collect the names of every worksheet in a workbook such
that the names are in adjacent cells in one worksheet. The number of
worksheets can vary and ideally I don't want to collect the names of the last
2 sheets but I can always just delete them manually.

B3 = sheet1 name
B4 = sheet2 name
B5 = sheet 3 name and so on


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Need Macro to Collect Multiple Worksheet Names

Sub CreateListOfSheetsOnFirstSheet()
Dim WS As Worksheet
For i = 1 To Worksheets.Count - 2
With Worksheets(1)
Set WS = Worksheets(i)
.Cells(i, 2).Value = WS.Name
End With
Next i
End Sub


Gord Dibben MS Excel MVP

On Sat, 20 Feb 2010 22:44:01 -0800, navel151
wrote:

I need a macro to collect the names of every worksheet in a workbook such
that the names are in adjacent cells in one worksheet. The number of
worksheets can vary and ideally I don't want to collect the names of the last
2 sheets but I can always just delete them manually.

B3 = sheet1 name
B4 = sheet2 name
B5 = sheet 3 name and so on

Thx.


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
How can collect data from multiple sheets in the same workbook? rrok Excel Discussion (Misc queries) 1 November 16th 09 03:20 AM
use a worksheet as a form to collect data Paul Kinnear Excel Worksheet Functions 4 January 20th 07 06:09 PM
Macro to capture worksheet names El Bee Excel Worksheet Functions 2 July 13th 06 05:56 PM
collect data from different worksheet sheva Excel Worksheet Functions 0 August 16th 05 03:22 PM
How do I collect data from an interactive web worksheet and impor. worksheetmom Excel Discussion (Misc queries) 3 February 20th 05 12:38 AM


All times are GMT +1. The time now is 08:09 AM.

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

About Us

"It's about Microsoft Excel"