#1   Report Post  
Posted to microsoft.public.excel.misc
JHL JHL is offline
external usenet poster
 
Posts: 56
Default Get sheet names

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Get sheet names

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
JHL JHL is offline
external usenet poster
 
Posts: 56
Default Get sheet names

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Get sheet names

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?


--
cao


"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Get sheet names

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Get sheet names

It didn't do anything different. It gives me the sheets in the same order as
the other. Say my sheets are March, February, January. Instead of it
showing as March in A2, February in A3, January in A4. I would like it to
show me January in A2, February in A3, March in A4. This way when I add
additional sheets the order on my master will always be in date order
--
cao


"Dave Peterson" wrote:

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Get sheet names

I should have read the suggested code:

Option Explicit
Sub testme()
Dim wCtr As Long
Dim rCtr As Long
rCtr = 1
For wCtr = Worksheets.Count To 1 Step -1
rCtr = rCtr + 1
With ActiveSheet.Cells(rCtr, 1)
.NumberFormat = "@" 'text
.Value = Sheets(wCtr).Name
End With
Next wCtr
End Sub




srctr wrote:

It didn't do anything different. It gives me the sheets in the same order as
the other. Say my sheets are March, February, January. Instead of it
showing as March in A2, February in A3, January in A4. I would like it to
show me January in A2, February in A3, March in A4. This way when I add
additional sheets the order on my master will always be in date order
--
cao

"Dave Peterson" wrote:

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Get sheet names

That worked great. Now this would be nice but I don't have to have it. Can
I eliminate the first 2 sheets from being put in the List - the Master sheet
and one other one.?
--
cao


"Dave Peterson" wrote:

I should have read the suggested code:

Option Explicit
Sub testme()
Dim wCtr As Long
Dim rCtr As Long
rCtr = 1
For wCtr = Worksheets.Count To 1 Step -1
rCtr = rCtr + 1
With ActiveSheet.Cells(rCtr, 1)
.NumberFormat = "@" 'text
.Value = Sheets(wCtr).Name
End With
Next wCtr
End Sub




srctr wrote:

It didn't do anything different. It gives me the sheets in the same order as
the other. Say my sheets are March, February, January. Instead of it
showing as March in A2, February in A3, January in A4. I would like it to
show me January in A2, February in A3, March in A4. This way when I add
additional sheets the order on my master will always be in date order
--
cao

"Dave Peterson" wrote:

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

--

Dave Peterson


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Get sheet names

Are they the two leftmost?

For wCtr = Worksheets.Count To 3 Step -1



srctr wrote:

That worked great. Now this would be nice but I don't have to have it. Can
I eliminate the first 2 sheets from being put in the List - the Master sheet
and one other one.?
--
cao

"Dave Peterson" wrote:

I should have read the suggested code:

Option Explicit
Sub testme()
Dim wCtr As Long
Dim rCtr As Long
rCtr = 1
For wCtr = Worksheets.Count To 1 Step -1
rCtr = rCtr + 1
With ActiveSheet.Cells(rCtr, 1)
.NumberFormat = "@" 'text
.Value = Sheets(wCtr).Name
End With
Next wCtr
End Sub




srctr wrote:

It didn't do anything different. It gives me the sheets in the same order as
the other. Say my sheets are March, February, January. Instead of it
showing as March in A2, February in A3, January in A4. I would like it to
show me January in A2, February in A3, March in A4. This way when I add
additional sheets the order on my master will always be in date order
--
cao

"Dave Peterson" wrote:

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Get sheet names

Yes they are. And this worked perfectly - so much better then always
building the formula to refer to each new sheet created.

Thanks so much
--
cao


"Dave Peterson" wrote:

Are they the two leftmost?

For wCtr = Worksheets.Count To 3 Step -1



srctr wrote:

That worked great. Now this would be nice but I don't have to have it. Can
I eliminate the first 2 sheets from being put in the List - the Master sheet
and one other one.?
--
cao

"Dave Peterson" wrote:

I should have read the suggested code:

Option Explicit
Sub testme()
Dim wCtr As Long
Dim rCtr As Long
rCtr = 1
For wCtr = Worksheets.Count To 1 Step -1
rCtr = rCtr + 1
With ActiveSheet.Cells(rCtr, 1)
.NumberFormat = "@" 'text
.Value = Sheets(wCtr).Name
End With
Next wCtr
End Sub




srctr wrote:

It didn't do anything different. It gives me the sheets in the same order as
the other. Say my sheets are March, February, January. Instead of it
showing as March in A2, February in A3, January in A4. I would like it to
show me January in A2, February in A3, March in A4. This way when I add
additional sheets the order on my master will always be in date order
--
cao

"Dave Peterson" wrote:

For x = 1 To Worksheets.Count
becomes
For x = Worksheets.Count to 1 step -1

srctr wrote:

I like this, but is there a way to reverse the order. Instead of the sheets
being ordered 1st thru last sheet, put it last sheet name in A2 and the first
sheet in the last cell?

--
cao

"JHL" wrote:

Mike H

PERFECT! Thanks.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You will
get a liest of sheet names in column a starting in a2

Sub sonic()
For x = 1 To Worksheets.Count
Cells(x + 1, 1) = Sheets(x).Name
Next
End Sub

Mike


"JHL" wrote:

Hello
I have a spreadsheet of 18 sheets each with a different name. I want to
pull those sheetnames into one more sheet in column A. From there I have a
formula to summarize data from those sheets, but it's a bear to have to type
each sheetname first.

Sheetnames
North
South
East
West
etc..

Thanks in advance.

--

Dave Peterson


--

Dave Peterson


--

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
Cell names = sheet names Vince Excel Worksheet Functions 9 February 8th 08 03:59 PM
Add Names of First Sheet and Automatically Add to Second Sheet Jorge Excel Discussion (Misc queries) 1 October 12th 06 10:48 PM
sheet names ceemo Excel Discussion (Misc queries) 2 February 2nd 06 06:50 PM
I want to print out the sheet tabs (sheet names) Sundus Excel Worksheet Functions 3 February 23rd 05 08:34 PM


All times are GMT +1. The time now is 09:58 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"