Change Hyperlink Subaddress in Specified Range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bertha94
    New Member
    • Aug 2007
    • 8

    Change Hyperlink Subaddress in Specified Range

    Hi,

    I have a macro that adds a row on my summary page, then adds a worksheet where the detail data will be entered for that row. I add the row by copying the row above it and inserting below. The only things i need to change are the subaddresses of all the hyperlinks that were copied down. My problem is that when I change the subaddress for the new row, it always changes the subaddresses of the row(s) above (or any other row with the same subaddress as the new row) even though I am only calling out that range. Here is my code:

    Range("G" & CO_Total_Row - 1 & ":" & "AQ" & CO_Total_Row - 1).Select
    Dim Old_Hyperlink_A ddress As String
    Old_Hyperlink_A ddress = "'CO" & Num_COs - 1 & "'!C1"
    Dim New_Hyperlink_A ddress As String
    New_Hyperlink_A ddress = "'CO" & Num_COs + 1 & "'!C1"
    Dim hLink As Hyperlink
    For Each hLink In Selection.Hyper links
    hLink.SubAddres s = New_Hyperlink_A ddress
    Next hLink

    Anyone have an idea why this doesn't work correctly?
Working...