Possible to add multiple (300+) hyperlinks that run the same VBA code?

The code that I want to run is very simple -- it takes the text of the cell containing the hyperlink and copies it a specific range. It also selects the specific range.

For example -- a list of 300+ symbols in one column:


Answer this question

Possible to add multiple (300+) hyperlinks that run the same VBA code?

  • wayneva

    Excellent, Duck!!!

    I'm not sure if that will work in my large spreadsheet with 300+ symbols but it certainly worked in my small example. Thanks so much for your help!

    Still dazed but a little less confused,

    CodeKid


  • Nate00

    Instead of using Target.Parent, use Target.TextToDisplay. This should sort things out. I've just tested code like this in Excel 2003 and it works fine. Let me know if you're still having trouble.



  • Andrew Mercer

    Not really sure I understand what you want, the symbol, will it be text and even if not where do you want it copied to . Wherever you want it copied to, that location can be found by "selection.address"

    Please give more info

    ChasAA


  • curiousss

    I want the text copied to the target cell (the cell jumped to once the hyperlink is clicked). The code needs to be the same for all hyperlinks on the page so that it copies the text from the current cell to the target cell. I added code to one worksheet as an example that looks like this:

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    Selection = Target.Parent
    End Sub

    On the worksheet where this code occurs, there are hyperlinks created that point to the same cell on another worksheet. (I just set this sheet up to learn how the code might work) It used to copy the text in the cell but would only work for the first hyperlink clicked. Now this code doesn't appear to do anything.

    Any input you can offer would be greatly appreciated.

    -CodeKid


  • Possible to add multiple (300+) hyperlinks that run the same VBA code?