+ Reply to Thread
Results 1 to 5 of 5

VBA to Paste a HYPERLINK to a cell without changing the cell content.

  1. #1
    Registered User
    Join Date
    07-15-2017
    Location
    London,England
    MS-Off Ver
    2013
    Posts
    17

    VBA to Paste a HYPERLINK to a cell without changing the cell content.

    I need to link a large number of hyperlinks to certain cells I choose and have tried to create a VBA macro to do this.

    I have copied a hyperlink from a source and then need to Paste that link into a cell without it changing the cell content.
    I have tried different PasteSpecial extensions but not been able to resolve this issue. Can someone suggest a way of doing this please.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA to Paste a HYPERLINK to a cell without changing the cell content.

    This sounded impossible at first

    Then I thought perhaps you could use a comment.

    To add a clickable hyperlink to comment, just do as follow steps:

    1. Right click at the cell you want to add hyperlink to its comment, and select Insert Comment from context menu.

    2. Then in the comment box, type the hyperlink address into it, and then remove other characters including the author name.

    3. Now you need to press Alt + End keys to make sure there are no other characters (including blank) in the comment box.

    4. Right click at the comment cell, and select Show/Hide Comments to show the comment.

    I used http://www.cnn.com and clicking in the comment box took me to the site.

    If you do not want the comment open all the time then I suppose you could either:-

    Use a macro to show the comment when you click on a cell
    Use a macro to open the hyperlink when you click on the cell
    Use a macro to swap the activecell contents with the contents of the comment


    This snippet worked.

    Please Login or Register  to view this content.

    This also worked

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 08-13-2017 at 06:39 AM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: VBA to Paste a HYPERLINK to a cell without changing the cell content.

    Hello
    Try this code .. Suppose you have range("A1:A" & lr) with hyperlinks and need to copy the hyper links only on the cells in column B
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Registered User
    Join Date
    07-15-2017
    Location
    London,England
    MS-Off Ver
    2013
    Posts
    17

    Re: VBA to Paste a HYPERLINK to a cell without changing the cell content.

    Thanks for this suggestion, but for my purpose I need to hyperlink the actual cell content rather than the comment.
    Any other suggestions welcomed.

  5. #5
    Registered User
    Join Date
    07-15-2017
    Location
    London,England
    MS-Off Ver
    2013
    Posts
    17

    Re: VBA to Paste a HYPERLINK to a cell without changing the cell content.

    Thanks, but my hyperlink is being copied from another source (a pdf document online) and it's that hyperlink I'm trying to start from the cell but leaving the original cell content.
    If there's a work around would be good to hear.

+ 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] RangetoHTML to paste cell content instead of table with content
    By moe15243 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2018, 07:13 PM
  2. [SOLVED] RangetoHTML to paste cell content instead of table with content
    By moe15243 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2017, 11:08 AM
  3. macro to move 1 cell left and paste CURRENT clipboard content as HYPERLINK
    By sgoesef in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2013, 01:31 PM
  4. [SOLVED] Hyperlink to cell in another worksheet depending on cell content
    By linkin1712 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-23-2013, 04:01 PM
  5. Auto-move previous content from cell a to cell b by changing cell a
    By Matt81a in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2013, 03:32 PM
  6. changing cell colours depending on cell content
    By jon@karhu in forum Excel General
    Replies: 6
    Last Post: 11-19-2008, 10:47 AM
  7. Replies: 3
    Last Post: 03-01-2006, 09:10 PM

Tags for this Thread

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