Excel 2010 edit Hyperlink when sheet copied.

Posted on 2012-09-19
Last Modified: 2012-09-20
I have a sheet that has a macro to create a copy of it.
The sheet has hyperlinks that link to various cells within the same sheet.

When the sheet is copied the hyperlinks in "CopySheet" still link back to the cells in "OrigSheet".
From what i can tell this is stored in SubAddress but i cant see how i can change all hyperlinks on the "CopySheet".

Any assistance greatly appreciated.

Question by:Andrew Davis
    LVL 39

    Accepted Solution

    Hi Andrew, try this

    Sub UpdateHyperlinks()
    Dim hl As Hyperlink
    For Each hl In ActiveSheet.Hyperlinks
        hl.SubAddress = Replace(hl.SubAddress, "OrigSheet", "CopySheet")
    End Sub

    Open in new window

    LVL 18

    Author Closing Comment

    by:Andrew Davis
    So simple and so close to what i had.... Doh!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now