Unhandled Perception
From the mind of a developer.

Thursday, July 17, 2008

Get URLs from hyperlinks in Excel

Just copy the code into the VBA editor (alt-F11) in Excel and make sure the sheet with hyperlinks is selected as the active worksheet before running (place cursor in the sub name and press F5). The URLs are placed in the cell next to the cell containing the hyperlink.


Sub GetURL()

Dim oHyperlink As Hyperlink

For Each oHyperlink In ActiveSheet.Hyperlinks
oHyperlink.Range.Offset(, 1) = oHyperlink.Address
Next

Set oHyperlink = Nothing

End Sub

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home