Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Put worksheet names into worksheet Excel 2000?

Hello,

The following code gives me this error "Run-time error '9': Subscript out of
range.

What I would like to do is put 25 of the 30 worksheet names from one
workbook into the same workbook on a worksheet but this is my problem I do
not want worksheet 1-5 included.

How can the following code be modified to put 25 of the 30 worksheet names
on one worksheet in the same workbook.

Thank you for you help,
James Cooper


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Put worksheet names into worksheet Excel 2000?

Hello,

I apologize I got in a hurry and did not include the code
here it is:

Sub sheets_list()
'prints sheet names to worksheet
r = ActiveCell.Row
s = ActiveCell.Column
ws = Sheets.Count
If ws 5 Then
For a = ws To 5 Step -1
Cells(r + a, s).Value = Sheets(a + 1).Name
Next a
End If
End Sub

Thank you for your help,
James Cooper



James Cooper wrote:
Hello,

The following code gives me this error "Run-time error '9': Subscript out of
range.

What I would like to do is put 25 of the 30 worksheet names from one
workbook into the same workbook on a worksheet but this is my problem I do
not want worksheet 1-5 included.

How can the following code be modified to put 25 of the 30 worksheet names
on one worksheet in the same workbook.

Thank you for you help,
James Cooper


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Put worksheet names into worksheet Excel 2000?

Hi James,

You have not included your problematic code.

However, try something like:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim i As Long
Dim j As Long

Set WB = Workbooks("MyTestFile.xls") '<<==== CHANGE
Set SH = WB.Sheets(1) '<<==== CHANGE

SH.Range("A1").CurrentRegion.Columns(1).ClearConte nts

For i = 6 To WB.Worksheets.Count
j = j + 1
SH.Cells(j, "A").Value = Sheets(i).name
Next i

End Sub
'<<=============


---
Regards,
Norman

"James Cooper" wrote in message
...
Hello,

The following code gives me this error "Run-time error '9': Subscript out
of range.

What I would like to do is put 25 of the 30 worksheet names from one
workbook into the same workbook on a worksheet but this is my problem I do
not want worksheet 1-5 included.

How can the following code be modified to put 25 of the 30 worksheet names
on one worksheet in the same workbook.

Thank you for you help,
James Cooper



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Put worksheet names into worksheet Excel 2000?

Hi James,

See response to your original post.


---
Regards,
Norman


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
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
Linking Tab/worksheet names to a worksheet cell LinLin Excel Discussion (Misc queries) 3 March 9th 09 03:31 PM
How to link Excel worksheet tab names to dates in each worksheet? Pat Excel Worksheet Functions 9 January 31st 05 07:51 AM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_3_] Excel Programming 0 September 22nd 04 03:26 PM


All times are GMT +1. The time now is 10:58 PM.

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"