+ Reply to Thread
Results 1 to 5 of 5

Replace hyperlinks

  1. #1
    Registered User
    Join Date
    01-29-2018
    Location
    Sofia, Bulgaria
    MS-Off Ver
    Excel 2013 (Office 15)
    Posts
    2

    Replace hyperlinks

    I am a complete novice in VBA.

    I'm trying to replace a huge number of hyperlinks with a macro, but I get compile errors. Here is the sub

    Sub ChangeLinks()
    For x = 1 To Application.ActiveSheet.Hyperlinks.Count
    Replace (Application.ActiveSheet.Hyperlinks(x).Address,"H:\Text\", "H:\Text\PG\")
    Next x
    End Sub

    The compile error is 'Expected ='

    Would you kindly tell me the correct way to change a substring in all hyperlinks with an

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    '97, 2016
    Posts
    2,523

    Re: Replace hyperlinks

    Hi Academica, welcome to the forum! Perhaps:
    Please Login or Register  to view this content.
    You weren't telling VBA where to put the string returned by the REPLACE function.
    Last edited by leelnich; 01-29-2018 at 02:58 AM.
    Clicking the Add Reputation star below any helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion. (Thread Tools above Post # 1) Thanks!-Lee

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,760

    Re: Replace hyperlinks

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    01-29-2018
    Location
    Sofia, Bulgaria
    MS-Off Ver
    Excel 2013 (Office 15)
    Posts
    2

    Re: Replace hyperlinks

    Thank you, Sixthsense
    You've saved me days of manual changing of hyperlinks. It's my first attempt with VBA.
    (I'm new to the forum. Where can I check the problem is solved?)

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    '97, 2016
    Posts
    2,523

    Re: Replace hyperlinks

    Quote Originally Posted by academica View Post
    Thank you, Sixthsense ...
    Wow, what did I do?? (compare posts # 2,3)
    You can use Thread Tools just above your original post to mark your thread as SOLVED. - Lee

+ 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. [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
  2. Replace multiple hyperlinks
    By syswiz88 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-31-2013, 05:50 AM
  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. Is it possible to use 'Replace All' function in hyperlinks
    By prabhat_79_in in forum Excel General
    Replies: 1
    Last Post: 08-04-2006, 02:15 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

Tags for this Thread

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