Sub TOC()
Dim ws As Worksheet
'Check each worksheet name to see if it is "TOC".
'If not, then create a new worksheet named "TOC"
'and place at the beginning of the workbook.
For Each ws In Worksheets
If ws.Name = "TOC" Then
GoTo Line1
End If
Next
With Worksheets.Add
.Name = "TOC"
.Move before:=Worksheets(1)
End With
'On worksheet named "TOC", first go to cell A3 and
'clear all cells to the end, then beginning at cell
'A3, start listing all the names of the worksheets
'in the workbook advancing the cursor one cell down.
Line1:
Worksheets("TOC").Select
Worksheets("TOC").Range("A3").Select
Worksheets("TOC").Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
Worksheets("TOC").Range("a3").Activate
For Each ws In Worksheets
If ws.Name <> "Sheet Names" Then
ActiveCell.Formula = ws.Name
ActiveCell.Offset(1, 0).Select
End If
Next
End Sub