I have a Macro that I found on this site to copy hyperlinks inserted through the ribbon to a different column in another sheet. However, the macro is only working on the first row.
I added Do
until because i = 7 to 1007
was not making it go to the next
. Now it is timing out and it still doesn't work. I'd just use a function for this but it is giving another user problems in Mac, so I'm trying to get around Mac being difficult.
I should state that some of the rows on the first sheet are blank.
Sub SwapIt()
Dim i As Integer
i = 7
Do Until i > 1007
Dim newLink As String
If Worksheets("Directory").Active = True Then
newLink = Worksheets("Modeling Tracker").Range("S" & i).Hyperlinks(1).Address ' Get the old horrible link :)
Worksheets("Directory").Range("B" & i).Hyperlinks.Add anchor:=Worksheets("Directory").Range("B" & i), Address:=Worksheets("Directory").Range("B" & i) 'turns it to a link
Worksheets("Directory").Range("B" & i).Hyperlinks(1).Address = newLink 'replace with the new link.
i = i + 1
End If
Loop
End Sub
Any help would be appreciated. This is driving me crazy.
Yay! I figured it out. Just a missing range.
Sub SwapIt()
Dim i As Integer
For i = 7 To 1007
If Worksheets("Modeling Tracker").Range("S" & i).Value > "" Then
Dim newLink As String
If Worksheets("Modeling Tracker").Range("S" & i).Hyperlinks.Count = 1 Then
newLink = Worksheets("Modeling Tracker").Range("S" & i).Hyperlinks(1).Address
Worksheets("Directory").Range("B" & i).Hyperlinks.Add Anchor:=Worksheets("Directory").Range("B" & i), Address:=Worksheets("Directory").Range("B" & i) 'turns it to a link
Worksheets("Directory").Range("B" & i).Hyperlinks(1).Address = newLink '' replace with the new link.
End If
End If
Next i
End Sub
Comments
Post a Comment