View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Melinda Chase Melinda Chase is offline
external usenet poster
 
Posts: 2
Default Skip sheets while indexing

Hello,
Nevermind, I got it figured out. Or at least well enough to get by.
Thanks!
Melinda

Sub SheetNamesSortedDownRows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim Rng As Range
Dim x As Long
Dim iRow As Long
iRow = 13
For x = 3 To ActiveWorkbook.Worksheets.Count
If ActiveWorkbook.Worksheets(x).Name < " " Then
iRow = iRow + 1
Cells(iRow, 3) = "'" & Left(Worksheets(x).Name, 9)
End If
Next x
Cells.Sort Key1:=Range("c14"), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("c14").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

"Melinda Chase" wrote in
message ...
Hello All,
I am trying to create an index of the sheets in my Excel file. I'm using
David McRitchie's code to create the index and all is working as it
should. What I would like to do is skip the first two sheets in the
workbook when indexing. How can I modify the below code to skip the first
two sheets?
Thanks!
Melinda

Sub SheetNamesSortedDownRows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim Rng As Range
Dim WS As Worksheet
Set Rng = Range("c14")
For Each WS In ActiveWorkbook.Worksheets
Rng.Value = "'" & WS.Name
Set Rng = Rng(2, 1)
Next WS
Cells.Sort Key1:=Range("c14"), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("c14").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub