Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:39+00:00 2026-05-27T22:36:39+00:00

I have a column containing hyperlinks and I want to do a programmatic search

  • 0

I have a column containing hyperlinks and I want to do a programmatic search and replace of the hyperlink address – the address itself, not the text to display. How do I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:36:40+00:00Added an answer on May 27, 2026 at 10:36 pm

    By modifying the “Address” property of the Hyperlinks element of a range object. Hyperlinks is a collection, so you will pick the first item if your range is a single cell, but it allows you to easily loop through all the links contained in a given range or worksheet.

    Here’s an example to change the link of the currently selected cell only (note: it must already have an hyperlink).

    Sub ChangeLink()
        Application.ActiveCell.Hyperlinks(1).Address = "www.test.com"
    End Sub
    

    Here’s a variation that changes all links in the current worksheet to http://www.google.com, as long as they are not currently pointing to http://www.google.com (not necessary, but just for demonstration’s sake):

    Sub ChangeLinks()
        For x = 1 To Application.ActiveSheet.Hyperlinks.Count
            If Application.ActiveSheet.Hyperlinks(x).Address <> "www.google.com" Then
                Application.ActiveSheet.Hyperlinks(x).Address = "www.google.com"
            End If
        Next x
    End Sub
    

    You can also add and delete links using the Hyperlinks.Add and .Delete methods.
    The TextToDisplay property allows you to change the text, and the Range property allows you to access (or figure out) which cells a given link belongs to.

    EDIT: As requested, here’s how to do it on all links in one specific column.

    Most often I like to create a few variables to assign (Set) the objects I’m working with, such as the worksheet (calling “Sheet1” here), then the actual column which I will refer to by myColumn. If you get an error message, this allows you to pinpoint where it fails exactly.

    Notice how the Hyperlinks collection adjusts itself nicely according to the object you call it from!

    I also added a check that shows a message if there are no links in the specified column.

    Sub ChangeLinksInColumn()
    Dim mySheet As Worksheet
    Dim myColumn As Range
    
    Set mySheet = Application.Worksheets("Sheet1")
    Set myColumn = mySheet.Columns(3) ' Enter column number here
    
    ' Check if column contains hyperlinks
    If myColumn.Hyperlinks.Count = 0 Then
      MsgBox "No hyperlinks in specified column."
    Else
      ' Perform task in myColumn only
      For x = 1 To myColumn.Hyperlinks.Count
          myColumn.Hyperlinks(x).Address = "www.google.com"
      Next x
    End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with a column containing text, and I want to select
I have a text column containing URLs that are uniqe. I need to do
I have a column containing list of streets. I need to replace 'street' with
I have a TIMESTAMP column containing: 2011-10-12 12:00:00 Now I want to be able
I have a column containing the strings 'Operator (1)' and so on until 'Operator
I have a column containing items that can be sorted by the user: DOC_ID
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have a file containing data in a single column .. I have to
I have a GridView where one column is bound to an object property containing
I have a SQL Server 2000 with a table containing an image column. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.