+ Reply to Thread
Results 1 to 5 of 5

Create hyperlink from cell contents and specified “text to display”

  1. #1
    Registered User
    Join Date
    02-25-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Office 365
    Posts
    62

    Create hyperlink from cell contents and specified “text to display”

    Hi there
    I want the code below, which is in a macro in the attached workbook, to create a hyperlink in the selected cell. The destination address should be created from the value in the cell, which is to a cell in another worksheet in the same workbook. The text to display should be “--->Sheet2”.

    Please Login or Register  to view this content.
    The code does create a hyperlink with the correct address, but the “text to display” is the cell value instead of “--->Sheet2”. Would someone please help me to get the “text to display” working as intended.

    Thanks,
    Stu
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Create hyperlink from cell contents and specified “text to display”

    Hello,

    since the hyperlink friendly text (TextToDisplay) gets added as text into the cell, you need to do the same thing you would need to do if you entered the string "---->Sheet2" into a cell. The string starts with a - sign and that causes Excel to expect a formula. Start the string with a single quote, then things will work fine.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-25-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Office 365
    Posts
    62

    Re: Create hyperlink from cell contents and specified “text to display”

    Hi teylyn
    Thanks for your response. It didn’t work initially, but then I added code to firstly convert the formula-generated value to a text value, and then convert to hyperlink with your suggested apostrophe.
    Great!
    Cheers, Stu

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-25-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Office 365
    Posts
    62

    Re: Create hyperlink from cell contents and specified “text to display”

    I tried to give you reputation but then accidentally deducted it and of course it went let me add it again. That’s unfortunate.
    Thanks for explaining how Excel expects a formula.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: Create hyperlink from cell contents and specified “text to display”

    I have corrected the neg rep for you, thanks
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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] Create a hyperlink to a place in the document using cell contents
    By Stuartzz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2018, 10:53 PM
  2. How to display active cell contents in text box
    By oxwilder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-28-2017, 01:42 PM
  3. Macro to find a word in a cell, create a transparent text zone over it, create a hyperlink
    By martin brandl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2015, 03:24 PM
  4. Create hyperlink paths based on cell contents
    By fundam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2013, 04:19 PM
  5. how can I display another cell as hyperlink text?
    By scorpioscouse in forum Excel General
    Replies: 18
    Last Post: 01-08-2010, 04:48 AM
  6. How to create a Web Hyperlink based on Cell Contents?
    By chatguy in forum Excel General
    Replies: 2
    Last Post: 10-15-2007, 04:24 PM
  7. Display ALL text contents in cell
    By Flipper1067 in forum Excel General
    Replies: 10
    Last Post: 07-27-2005, 09: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