Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put worksheet names into worksheet Excel 2000?
Hi James,
See response to your original post. --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
using the Excel generic worksheet names instead of user-given names in code | Excel Discussion (Misc queries) | |||
Linking Tab/worksheet names to a worksheet cell | Excel Discussion (Misc queries) | |||
How to link Excel worksheet tab names to dates in each worksheet? | Excel Worksheet Functions | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming |