Activate or de-activate hyperlinks in range

Brief description:

Adds or removes hyperlinks to cells in selected range using the contents of the cell as the address

Full description:

Add or remove hyperlinks to cells in selected range using the contents of the cell as the address.

Use: Select the desired range containing the URLs and run ‘ActivateLink()’. Remove the hyperlinks by selecting the desired range and running ‘DeleteLink()’.

Note: No testing of link validity is conducted.

 

Code:
Sub ActivateLink()

'Add hyperlinks to cells in selected range
' using the contents of the cell as the address

Dim CurrRange As Range, CurrCell As Range

Set CurrRange = Selection

For Each CurrCell In CurrRange
CurrCell.Hyperlinks.Add CurrCell, Address:=CurrCell.Value
Next CurrCell

End Sub

Sub DeleteLink()
'Remove hyperlinks from cells in selected range

Dim CurrRange As Range, CurrCell As Range

Set CurrRange = Selection

For Each CurrCell In CurrRange

Next CurrCell
 CurrCell.Hyperlinks.Delete
End Sub