View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
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