+ Reply to Thread
Results 1 to 9 of 9

Creating a hyperlink with a macro

  1. #1
    Registered User
    Join Date
    11-17-2007
    Posts
    5

    Creating a hyperlink with a macro

    Hi all,

    I would like your help in creating a hyperlink in a sheet, pointing from the selected cell to a different cell in the same sheet.

    The user is supposed to select a cell, and activate the macro.
    The macro should pop up an inputbox to allow the user to select (point) a different cell in the sheet.
    The macro should then create a hyperlink to this cell.

    The cell will usually contain a Dollar value, and the target cell will usually contain a name of a part.

    If possible, I would also like the macro to show, in the cell adjacent to the cell that contains the link, the value of the target cell. For example, the user will see in the linked cell a certain Dollar value (i.e. $1000) and next to it, he will see the value of the linked/target cell (i.e. the part's name).

    I have tried and tried but never succeeded in doing that… even when I managed to create a link, it didn't work (I received an error message stating that there is an invalid reference).

    Your help will be highly appreciated.

    Regards,

    Dror

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523
    Hi,
    Let's see what you have so far, and go one step at a time.
    Zip an copy of what you have and attach it to your next post,so somebody will be able to look at it

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Try this:
    Please Login or Register  to view this content.
    EDITED AS PREVIOUS CODE DIDN'T WORK CODE ABOVE WORKS FINE!
    Last edited by Simon Lloyd; 11-17-2007 at 01:38 PM.
    Not all forums are the same - seek and you shall find

  4. #4
    Registered User
    Join Date
    11-17-2007
    Posts
    5

    Here is a sample file

    Simon, thanks for the code but I can't get it to work.

    Attached is a sample of the file as i need it to look (it is just a rough format and will change for sure...).
    In any case, you can see "my" macro (which does not work) as well as Simon's macro (in sheet1).

    Thanks for your time,

    Dror
    Attached Files Attached Files

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Dror,

    This macro uses the ActiveCell's text as the text for the Hyperlink. The Hyperlink will go to any cell on any Worksheet the user chooses with the InputBox.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  6. #6
    Registered User
    Join Date
    11-17-2007
    Posts
    5

    Thumbs up

    Works like a charm.
    Thank you all for your help!

  7. #7
    Registered User
    Join Date
    11-17-2007
    Posts
    5

    Red face Another linking question

    Hi there,
    It’s me again… Can I possibly ask for another favor?

    Now that this hyperlink macro works so nicely, I thought it would be a great idea if while linking cell X to cell Y, the macro will create a “back link” from Y to X.

    Since all links (in this specific file) will always be 1:1 (and unique), I want the user to be able to navigate easily between the origin cell and the target cell and BACK.
    If there is an automatic back-link, the user will be able to click on the origin cell, jump to the target cell (and check whatever he wants) and then click the same cell and jump back to the origin cell (sort of like a “back” feature).

    I think the best way will be to do it a two-step action. The first will be to create the initial link (this is what the macro is doing now) and the second step will be to popup another box and ask the user if he wants to create a back-link (if “yes” – do the back-link to the origin cell. If “no” – exit the macro).

    I thank you in advance for your time and support,

    Regards,

    Dror

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Dror,

    This macro creates a hyperlink to the cell of the user's choosing, and then asks to create a backward hyperlink.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  9. #9
    Registered User
    Join Date
    11-17-2007
    Posts
    5

    Thumbs up Amazing

    WOW !!!! I can't thank you enough. You are a life saver.
    I'll give it a test run later on today (I've got to run now... )
    All the best,
    Dror

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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