Excel Worksheet Index

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2013-06-29T22:19:46Z Indexed on 2013/06/29 22:21 UTC
Read the original article Hit count: 211

Filed under:
|
|
|

I have the following code that works great but I am trying to modify it so that instead of replacing column 1 of the Index page with a new index I would rather start the range in Cell C11. Right now, the new Index starts in Cell A1 of the Index sheet.

Here is the code:

Private Sub Worksheet_Activate() Dim wSheet As Worksheet Dim l As Long

l = 1

With Me
    .Columns(1).ClearContents
    .Cells(1, 1) = "INDEX"
    .Cells(1, 1).Name = "Index"
End With


For Each wSheet In Worksheets
    If wSheet.Name <> Me.Name Then
        l = l + 1
            With wSheet
                .Range("A1").Name = "Start_" & wSheet.Index
                .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
                SubAddress:="Index", TextToDisplay:="Back to Index"
            End With

            Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", _
            SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name
    End If
    Next wSheet

End Sub

I have successfully modified the code so that the link back to the index on each sheet is in cell A4 without trouble, but I can't figure out how to have the index be replaced starting at Cell C11

© Stack Overflow or respective owner

Related posts about excel

Related posts about vba