Thread: Worksheet Name
View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Worksheet Name

Missed your code

With Worksheets(2)
.Columns(10).ClearContents
i = 3
For Each sh In ThisWorkbook.Worksheets
If bFlag Then
.Cells(i, "J").Value = sh.name
i = i + 1
End If
If LCase(sh.name) = "template" Then bFlag = True
Next sh
End With

To start adding names after sheet template in the tab order

--
Regards,
Tom Ogilvy




Todd Huttenstine wrote in message
...
I have modified the code (see below)
Here is the problem. According to the current code, the
first sheet displayed is "template"(because it is written
in the code), however I need it to start with the next
sheet which is unknown because the name of that sheet may
change. That sheet will always be sheet number 4 so is
there anyway to specify to start with sheet number 4? For
instance. The next sheet after sheet "template" is
called "Tammy". The code needs to specify to start
listing the sheets with sheet4 (which in this case
is "Tammy") Therefor I need to specify in the code to
start listing sheets with sheet4, instead of the name of
the actual sheet.



Dim sh As Worksheet
Dim i As Long
Dim bFlag As Boolean

With Worksheets(2)
.Columns(10).ClearContents
i = 3
For Each sh In ThisWorkbook.Worksheets
If LCase(sh.name) = "template" Then bFlag = True
If bFlag Then
.Cells(i, "J").Value = sh.name
i = i + 1
End If
Next sh
End With