+ Reply to Thread
Results 1 to 13 of 13

Find and Replace part of hyperlinks path?

  1. #1
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Find and Replace part of hyperlinks path?

    Hi everyone,

    I have a spreadsheet with hundreds of the following link addresses:

    madeupname.com/download/logpdfs/002.pdf/

    etc.

    I need to change all of them to:

    madeupname.com/wp-content/uploads/logs/002.pdf

    etc.

    So I basically need to change this part of the path

    madeupname.com/download/logpdfs/

    to

    madeupname.com/wp-content/uploads/logs

    without changing the actual file name, ie 001.pdf

    Is this possible using VBA?

    I've searched the web for VBA examples but I can't get them to work

    Cheers, Martin

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Find and Replace part of hyperlinks path?

    have you tried a simple find and replace?
    Find what >> download/logpdfs
    Replace with >> wp-content/uploads
    it worked on my sample.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    Hi Sambo kid,

    Unfortunately Find and Replace doesn't work with hyperlinked content.

    opinions.co.il/ogdan/find-and-replace-hyperlinks-url-links-in-excel

    But I'm not sure if any code like the above will work on replacing only the main part of the path, and leave the file name alone?

    Cheers, Martin

  4. #4
    Registered User
    Join Date
    08-20-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Find and Replace part of hyperlinks path?

    Hi,
    Just select the link cell or entire column where the links was placed and hit find and replace (see attached).
    Attached Images Attached Images

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Find and Replace part of hyperlinks path?

    If they are actual hyperlinks, rather than HYPERLINK formula then try this in the immediate window.
    ALT+F11 (open VBE)
    CTRL+G (Open immediate window)
    Copy+Paste
    Press Enter

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    Thanks Andy,

    The full replacement should be as screenshot below, the forum wouldn't let me post links and I missed a folder

    However it only replaces 5 of the first of 200+ entries.

    Do I need to select all the hyperlinked cells?

    Where do I press Enter?replace hyperlinks.png

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Find and Replace part of hyperlinks path?

    You do not need to select any cells.
    You just need to have the cursor at the end of the line of code and press enter.

    But how did you manage to replace 5 of the 200+ if you did not know how to execute the code?

    Are all the hyperlinked cells on the same sheet?

  8. #8
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    Hi Andy,

    I just pressed enter at the end of the line of code after following your instructions

    Yes, all the hyperlinks are on the same spreadsheet.

    If I could post a link I could upload the file...

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Find and Replace part of hyperlinks path?

    Why do you need to post a link. Use the upload facility on the site
    There is a big yellow banner at the top of the page telling you what to do, as well as these instructions


    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  10. #10
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    In the attached sheet, it is the Column called "Name of Log" that I'm trying to change hyperlinks for.

    The cells that were correctly highlighted have a yellow highlight on that row.

    There's also the links replacement addresses described.

    Thanks, Martin
    Last edited by lovelyjubbly; 06-08-2020 at 04:56 AM. Reason: Remove spreadsheet

  11. #11
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    I think I've worked out why, some of the links have http.www instead of just http....

  12. #12
    Registered User
    Join Date
    06-07-2020
    Location
    sydernee
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Find and Replace part of hyperlinks path?

    That was it!

    Thank you ever so much Ian

    Best wishes, Martin

  13. #13
    Registered User
    Join Date
    12-24-2021
    Location
    Paris, France
    MS-Off Ver
    MS Office 365
    Posts
    1

    Re: Find and Replace part of hyperlinks path?

    Quote Originally Posted by Andy Pope View Post
    If they are actual hyperlinks, rather than HYPERLINK formula then try this in the immediate window.
    ALT+F11 (open VBE)
    CTRL+G (Open immediate window)
    Copy+Paste
    Press Enter

    Please Login or Register  to view this content.
    Works like a charm. Tks a lot Andy.
    Merry Xmas and a happy New Year

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-18-2017, 02:55 PM
  2. [SOLVED] Find/Replace a series of hyperlinks in a workbook
    By mellenbal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-03-2014, 05:15 PM
  3. Find and Replace with hyperlinks
    By sundayss in forum Excel General
    Replies: 0
    Last Post: 09-08-2011, 02:53 AM
  4. find & replace multiple terms with hyperlinks
    By DMR1712 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2009, 10:33 AM
  5. find/replace text in multiple hyperlinks
    By notorious22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2007, 06:33 PM
  6. [SOLVED] find and replace path name in Excel cells containing hyperlink
    By leoe in forum Excel General
    Replies: 1
    Last Post: 08-09-2005, 04:05 PM
  7. Can I use Find and Replace all with Hyperlinks?
    By HandsOnManager in forum Excel General
    Replies: 0
    Last Post: 02-15-2005, 06:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1