VBA macro to turn text URLs to clickable links [Excel]

VBA macro to turn text URLs to clickable links in excel spreadsheet.

This macro

  1. Checks whether cell has text URL or not
  2. If the cell contains text URL, then it turns it into clickable URL
  3. Moves to cell in the next row
  4. Repeats the steps from 1 to 3 until it reaches an empty cell

VBA code to convert text URLs to clickable links

Sub textUrlsToclickableURLs()
Do
' Checks if it is a text URL
 If InStr(ActiveCell.Value, "http://") Or InStr(ActiveCell.Value, "https://") Then
 ' Turning the text URL into clickable URL
 ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=ActiveCell.Value, _
 TextToDisplay:=ActiveCell.Value
 End If
 ' Move to text URL in next row
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = ""
End Sub

About the Author

SRINI S

A passionate blogger. Love to share solutions and best practices on wordpress hosting, issues and fixes, excel VBA macros and other apps

Leave a Reply

Your email address will not be published. Required fields are marked *