Hyperlink

Harikrushna

New Member
Joined
Oct 31, 2014
Messages
18
I am having workbook containing number of worksheets say around 200. in summary sheet ( sheet no. 1 ) , I have list of name of all worksheet having hyperlink to particular sheet. now i want to change hypelink all together . any formula or any VBA code available ?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Try:

Code:
Sub CreateTOC()
    '   Code by Zack Baresse
    If ActiveWorkbook Is Nothing Then
        MsgBox "You must have a workbook open first!", vbInformation, "No Open Book"
        Exit Sub
    End If
    
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
    
        Dim WS As Worksheet, _
            ct As Chart, _
            shtName As String, _
            nrow As Long, _
            tmpCount As Long, _
            i As Long, _
            numCharts As Long
        
        nrow = 3
        i = 1
        numCharts = ActiveWorkbook.Charts.Count
        
        On Error GoTo hasSheet
        Sheets("Summary").Activate
        If MsgBox("You already have a Summary page.  Would you like to overwrite it?", _
        vbYesNo + vbQuestion, "Replace TOC page?") = vbYes Then GoTo createNew
        Exit Sub

hasSheet:
    Sheets.Add before:=Sheets(1)
    GoTo hasNew

createNew:
    Sheets("Summary").Delete
    GoTo hasSheet

hasNew:
    tmpCount = ActiveWorkbook.Charts.Count
    If tmpCount > 0 Then tmpCount = 1
        ActiveSheet.Name = "Summary"
        
        With Sheets("Summary")
            '.Cells.Interior.ColorIndex = 4
                With .Range("B2")
                    .Value = "Summary"
                    .Font.Bold = True
                    .Font.Name = "Calibri"
                    .Font.Size = "24"
                End With
        End With
        
        For Each WS In ActiveWorkbook.Worksheets
            nrow = nrow + 1
            With WS
                shtName = WS.Name
                With Sheets("Summary")
                    .Range("B" & nrow).Value = nrow - 3
                    .Range("C" & nrow).Hyperlinks.Add _
                        Anchor:=Sheets("Summary").Range("C" & nrow), Address:="#'" & _
                        shtName & "'!A1", TextToDisplay:=shtName
                    .Range("C" & nrow).HorizontalAlignment = xlLeft
                End With
            End With
        Next WS
        
        If numCharts <> 0 Then
            For Each ct In ActiveWorkbook.Charts
                nrow = nrow + 1
                shtName = ct.Name
                With Sheets("Summary")
                    .Range("B" & nrow).Value = nrow - 3
                    .Range("C" & nrow).Value = shtName
                    .Range("C" & nrow).HorizontalAlignment = xlLeft
                End With
            Next ct
        End If
        
        With Sheets("Summary")
            With .Range("B2:G2")
                .MergeCells = True
                .HorizontalAlignment = xlLeft
            End With
        
            With .Range("C:C")
                .EntireColumn.AutoFit
                .Activate
            End With
            .Range("B4").Select
        End With
    
        .DisplayAlerts = True
        .ScreenUpdating = True
    End With
    
    MsgBox "Done!" & vbNewLine & vbNewLine & "Please note: " & _
        "Charts are listed after regular " & vbCrLf & _
        "worksheets and will not have hyperlinks.", vbInformation, "Complete!"

End Sub
 
Upvote 0
If new sheets are added how do we determine what your "different" name for them would be?
 
Upvote 0
thats true. then can you suggest to change the list without changing hyperlink i.e. if in list hyperlink is with name 123 and i want to make it ABC instead of 123 without changing hyperlink?
 
Upvote 0
How do we know that 123 needs to become ABC?
 
Upvote 0
i have list of such corresponding conversion. without changing manually individul- by coding or formula can we change as list is too long
 
Last edited:
Upvote 0
Where is this list - what sheet, what range of cells.

Where are the corresponding list of values that need to be changed (I understand they are in the sheet called summary) -but what is the range of cells?

Are the values that need changing part of the hyperlink (i.e. the "Friendly name") or are they in cells by themselves?

I'm not going to be on-line for a while now, so will look later (if no-one else jumps in in the meantime) after you have answered these questions.
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,841
Members
449,193
Latest member
MikeVol

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top