+ Reply to Thread
Results 1 to 10 of 10

Editing HyperLinks

Hybrid View

  1. #1
    Registered User
    Join Date
    07-31-2007
    Posts
    6

    Editing HyperLinks

    Hi

    I need to edit the hyperlinks in my excel sheet. I know how to do this manually and edit one at a time, but I need to change 3000 of them!

    Is there a way I can do this without going through each one?

    Thanks in advance

    Simba

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon simba_cubs

    ...and welcome to the forum!!

    I need to edit the hyperlinks in my excel sheet
    What do you mean by "edit"? Can you provide some examples as to what you have to do to each one?

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    07-31-2007
    Posts
    6
    Yes of course.

    Currently I have 3000 hyperlinks which point to http://webserver/dir1/dir2/filename

    I need to change this to c:\inetpub\dir1\dir2 - keeping the same filenames

    Hope that make sense?

    Thanks

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi simba_cubs

    **BACK UP YOUR WORK**

    Then, on a copy of your workbook, arrow to the first hyperlink, then hold down shift and navigate to the last hyperlink and left click on it. This should now have selected all the hyperlinks.

    Now run this macro and it should go through all links replacing the path and leaving the file unchanged.

    Sub Test()
    oldlink = "http://webserver/dir1/dir2/"
    newlink = "c:\inetpub\dir1\dir2\"
    For Each usrcell In Selection
    yourfile = Right(usrcell.Hyperlinks(1).Address, Len(usrcell.Hyperlinks(1).Address) - Len(oldlink))
    usrcell.Hyperlinks(1).Address = newlink & yourfile
    Next usrcell
    End Sub
    HTH

    DominicB

  5. #5
    Registered User
    Join Date
    07-31-2007
    Posts
    6
    Hi DominicB

    Thanks for your quick reply.

    I created a macro and ran it against the worksheet, but I received the following error :^(


    Run-time error '5':

    Invalid procedure call or argument.

    Any idea's?

    Thanks

    Simba

  6. #6
    Registered User
    Join Date
    07-31-2007
    Posts
    6

    Smile

    Hi DominicB

    It's worked! It changed the links even though I received the error I posted previous to this message.

    Although it seems to have changed the links, why would I receive the error message. Sorry but I'm a bit of a newbie when it comes to macro's of that nature :^|

    Thanks again in advance

    Simba

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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