Home > Mobile >  Changing TextToDisplay for Hyperlinks in Excel via VBA
Changing TextToDisplay for Hyperlinks in Excel via VBA

Time:06-25

Newbie here, looking for some help with VBA scripting.

Goal:
Run a VBA script to replace the display text for any hyperlinks in an Excel sheet starting with enter image description here

CodePudding user response:

Try this:

Sub ReplaceHyperlinks()
    Dim Ws As Worksheet
    Dim lnk As Hyperlink
    Set Ws = Application.ActiveSheet
    For Each lnk In Ws.Hyperlinks
        If LCase(lnk.Address) Like "*google.com*" Then 'Google link ?
            lnk.TextToDisplay = "Google"
        End If
    Next
End Sub
  • Related