+ Reply to Thread
Results 1 to 4 of 4

Hyperlink address no longer valid

Hybrid View

  1. #1
    Registered User
    Join Date
    12-25-2023
    Location
    Woodbury, NY
    MS-Off Ver
    Home and Student 2016
    Posts
    2

    Hyperlink address no longer valid

    I have a personal check register spreadsheet that I created in January, 2009 and have used every day since. In nearly 15 years of use, it has grown to 7 tabs and over 13,000 line items. In spite of its size, it is basically a simple spreadsheet containing data like checks, deposits, Venmo or Zelle payments, cash transfers, etc. Until recently I never encountered any major problems, and I was always able to fix the minor issues on my own. The latest issue, however, has me stumped and I've been unable to figure a solution.

    Each line item has a cell which contains a hyperlink that points to a unique image file, i.e., .jpg or .pdf. So if I click on the displayed text (I use ASCII 254 or "■") in the hyperlink, the image is displayed. It might be a credit card statement or a cancelled check or anything else I want to be able to view.

    In the address line for creating the hyperlink, Excel allows you to browse to a specific file location. When you finish, the address Excel has created does not include the drive letter but instead a reference to it that I do not understand. If, for example, a .jpg copy of check #1234 exists in folder "Checks" on drive C:, Excel initially created an address of "..\..\..\..\checks\1234.jpg" I've copied and pasted this type of address thousands of times over the years changing the specific data in the address and have never had a problem. If I had initially overwritten the format used by Excel to refer to which physical drive it was accessing, i.e., "c:\checks\1234.jpg" and had copied THAT address thousands of times, I would have been able to view the image file and would not have the problem I am currently encountering.

    Over 15 years, I've moved this spreadsheet back and forth dozens of times between computers I have in two locations. The addresses using the "..\..\..\.." to refer to drive C: have never caused any issues.

    I recently purchased a new computer which came installed with Windows 11. This is the first time I've used Windows 11 and I mention it only in the spirit of full disclosure. I have no idea if it is in any way a part of my problem.

    On the new computer I installed the version of Excel I've been using for a while now, i.e. Home and Student 2016. After an uneventful and successful install, I copied all of my Excel files to the same folder as before. The file "Checks.xlsx" loads as it should but here (FINALLY !!) is the problem. Clicking on any of the hyperlinks returns the message "The address of this site is not valid. Check the address and try again." I've discovered two changes to the hyperlink which make the address "valid". One change is to replace the "..\..\..\.." with "..". The other change that works is to replace the "..\..\..\.." with "c:". That's fine one line at a time but as each line item in the spreadsheet contains 2 hyperlinks, I would need to manually change nearly 25,000 of them to make this spreadsheet wholly functional again.

    I've tried the Search and Replace function but cannot figure a way to do this. Is there an efficient fix to this problem or do I need to manually fix, let's say, 20 a day for 3½ years?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Hyperlink address no longer valid

    Hi there,

    The code below is looping through all cells on a sheet and replacing part of the hyperlink with a new bit. In this case; "..\..\..\.." with "c:".

    Please make a copy of the full file before running the code.

    Let us know how you go with this



    Option Explicit
    
    Sub UpdateHyperlinks()
    
        Dim LinkCount As Long
        Dim newURL As String, URL As String, HLold As String, HLnew As String
        Dim Rng As Range
            
        HLold = "..\..\..\.."   ' Set part of hyperlink to replace
        HLnew = "c:"            ' Set new part for hyperlink
        
        For LinkCount = 1 To ActiveSheet.Hyperlinks.Count
            URL = ActiveSheet.Hyperlinks(LinkCount).Address
            URL = Replace(URL, HLold, HLnew)
            ActiveSheet.Hyperlinks(LinkCount).Address = URL
        Next LinkCount
        
    MsgBox "Hyperlinks on the current sheet have been updated.", vbInformation, "Hyperlink Updated"
        
    End Sub
    Attached Files Attached Files
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  3. #3
    Registered User
    Join Date
    12-25-2023
    Location
    Woodbury, NY
    MS-Off Ver
    Home and Student 2016
    Posts
    2

    Re: Hyperlink address no longer valid

    ORoos:

    It worked !! Quickly and efficiently too.

    Surprisingly, on the first attempt, it did not change ALL the hyperlinks. When I examined why, I found that thousands of the older cells contained hyperlinks with "../../../../" instead of "..\..\..\..". As I said, this spreadsheet is 15 years old and I suppose Excel changed its drive designation coding somewhere along the way. A simple change to your macro solved this problem.

    Thanks so much.

    Regards,
    Elliott

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Hyperlink address no longer valid

    Glad it worked for you Elliott.

    If this has answered your query, please take the time to mark this post as 'Solved'. You can do this via the drop-down options at the top under 'Thread Tools.

    Cheers

+ 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] Need Help with HTMLBody. Hyperlink email address and web address in body message VBA
    By Christopher Val in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2015, 04:39 PM
  2. [SOLVED] Run time error '1004': The address of this site is not valid. Check the address the addre
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 06:59 AM
  3. Replies: 2
    Last Post: 02-12-2013, 12:55 PM
  4. Replies: 3
    Last Post: 10-02-2012, 12:25 PM
  5. Pivot table drop down list with data no longer valid?
    By John_Mtl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2007, 11:01 AM
  6. [SOLVED] Checking usewr has input a valid address
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2006, 06:15 AM
  7. [SOLVED] Checking user has input a valid address.
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2006, 07:00 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