+ Reply to Thread
Results 1 to 2 of 2

excel macro to modify Hyperlink to copy and paste

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    1

    excel macro to modify Hyperlink to copy and paste

    Hello,

    I have a workbook that has 2 worksheets. Sheet1 has a data table that is filled from an SQL database. I would like the first column of the data table to have each cell be a hyperlink. The destination of the hyperlink is Sheet2, cell A2. I would like to modify the hyperlink, so that when the user clicks on the hyperlink, the text-display of the hyperlink is copied into sheet2 cell A2. Initially, I thought this was simple. I added the event code shown below:

    Please Login or Register  to view this content.
    this worked, however there was a problem. I manually added the hyperlink to all cells in column1 of sheet1. However, this made the TextToDisplay property the value of the first cell for all hyperlinks. So I am curious if you have a solution to add hyperlinks to all cells in the first column, with TextToDisplay property set for each individual cell. I have a few ideas of how to do this, but I am curious what is the best way to do this with the fact that the number of rows in column1 will vary as the size of the SQL query changes?

    ok, thanks
    Last edited by jffwright82; 02-16-2014 at 06:04 PM. Reason: code tags

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: excel macro to modify Hyperlink to copy and paste

    Hi jffwright82,

    I think what you are looking for uses something like the following:
    Please Login or Register  to view this content.
    Try the attached workbook, which implements the above code.

    Lewis

+ 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. Macro to hyperlink and copy/paste value to 2nd worksheet???
    By AudreaBull in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2013, 05:27 AM
  2. [SOLVED] Excel 2010 - Copy and Paste as Hyperlink
    By rangiesrule in forum Excel General
    Replies: 3
    Last Post: 11-02-2012, 01:14 AM
  3. [SOLVED] Macro to Copy data and Paste it into every 7th row in another sheet with hyperlink
    By dani_n88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2012, 11:22 PM
  4. Replies: 0
    Last Post: 03-23-2012, 05:59 PM
  5. Macro to Copy and Paste the hyperlink cell value.
    By mvel_sky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2009, 12:22 AM

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