Advertisement
oshkoshbagoshh

tableofcontents

Aug 18th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '*******************************************************************************
  2. ' TABLE OF CONTENT: Creates Worksheet with links to all other worksheets
  3. '
  4. '                           ~ AJ Javadi ~
  5. '*******************************************************************************
  6.  
  7. Sub TableofContent()
  8. Dim i As Long
  9. On Error Resume Next
  10. Application.DisplayAlerts = False
  11. Worksheets("Table of Content").Delete
  12. Application.DisplayAlerts = True
  13. On Error GoTo 0
  14. ThisWorkbook.Sheets.Add Before:=ThisWorkbook.Worksheets(1)
  15. ActiveSheet.Name = "Table of Content"
  16. For i = 1 To Sheets.Count
  17. With ActiveSheet
  18. .Hyperlinks.Add _
  19. Anchor:=ActiveSheet.Cells(i, 1), _
  20. Address:="", _
  21. SubAddress:="'" & Sheets(i).Name & "'!A1", _
  22. ScreenTip:=Sheets(i).Name, _
  23. TextToDisplay:=Sheets(i).Name
  24. End With
  25. Next i
  26. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement