Update sheet reference for hyperlink

bpolkusm

New Member
Joined
Nov 20, 2017
Messages
14
Hello Everyone,

I have 111 worksheets in a workbook. Each worksheet has an area in I2- I9, K2-K9,M2-M9 O2-O5. The cell reference for each cell is the same I2 take you to B12 on sheet CV-1 and I2 on sheet CV-2 should take you to B12 on sheet CV-2 and so on. Basically each hyperlink on that worksheet takes you to a location in that worksheet. Does anyone know a way to update all the sheet hyperlinks with out doing it manually and maintaining the cell reference?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello Bpolkusm,
here is code that allows you to automatically change hyperlink subaddress on each worksheet.
Suppose that all your sheets have prefix "CV-" and that only last numbers increasing.
You need to change "B12" and "I2" values in this code depeending of your needs.
Do this for each hyperlinks replacement.
VBA Code:
Sub ReplaceLinkSubAddress()
    
    Dim vWS As Worksheet
    Dim vR1 As Range, vR2 As String

'make hyperlink on each sheet go to this cell
    vR2 = "B12"
    With ActiveWorkbook
        For Each vWS In Worksheets
            With vWS
'make this cell with hyperlink change subaddress on each worksheet
                Set vR1 = .Range("I2")
                vR1.Hyperlinks.Delete
                .Hyperlinks.Add _
                vR1, "", "'CV-" & vWS.Index & "'!" & vR2
            End With
        Next vWS
    End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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