0% found this document useful (0 votes)
30 views1 page

Update Links Macro

The provided VBA code updates links in an Excel worksheet. It copies data from column L to column N and replaces specific URLs in both columns. After the updates, a message box confirms the successful completion of the operation.

Uploaded by

Pravin Abhale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views1 page

Update Links Macro

The provided VBA code updates links in an Excel worksheet. It copies data from column L to column N and replaces specific URLs in both columns. After the updates, a message box confirms the successful completion of the operation.

Uploaded by

Pravin Abhale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sub UpdateLinks()

Dim ws As Worksheet
Dim lastRow As Long
Dim i As Long

' Set reference to the active worksheet


Set ws = ActiveSheet

' Find the last row in column L


lastRow = [Link]([Link], "L").End(xlUp).Row

' Copy column L to column N


[Link]("L2:L" & lastRow).Copy [Link]("N2")

' Replace text in column N


For i = 2 To lastRow
If Not IsEmpty([Link](i, "N")) Then
[Link](i, "N").Value = Replace([Link](i, "N").Value, _
"[Link] _
"[Link]
End If
Next i

' Replace text in column L


For i = 2 To lastRow
If Not IsEmpty([Link](i, "L")) Then
[Link](i, "L").Value = Replace([Link](i, "L").Value, _
"[Link] _
"[Link]
End If
Next i

MsgBox "Links updated successfully!", vbInformation


End Sub

You might also like