+ Reply to Thread
Results 1 to 7 of 7

Create a Hyperlink Macro

  1. #1
    Registered User
    Join Date
    01-08-2009
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    14

    Smile Create a Hyperlink Macro

    Can this be done? This is what I want to do. Say I have a workbook open and my A column cells are filled with (example) Mike-1 in the first row Mike-2 in the second row and so on. Now I have another folder on the computer with Word documents that I want to hyperlink to. The corresponding Word file is named mike1. So I want Excel to go through column A and Hyperlink to the corresponding Word file. Is it possible to do this?
    Last edited by BostonMike; 02-09-2010 at 05:31 PM. Reason: Solved!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Create a Hyperlink Macro

    This code cycles through the selected range and creates file links base on the cell contents by:
    • Removing the dashes in the cell value
    • Prepending a file path
    • Appending a file type
    • Creating the link from the result
    Note: The display text is not change.

    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    01-08-2009
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Create a Hyperlink Macro

    Woah, cool. I see your notes in the code on where to replace with my data but I'm such an Excel neophyte I don't know where to place the code.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Create a Hyperlink Macro

    Quote Originally Posted by BostonMike View Post
    Woah, cool. I see your notes in the code on where to replace with my data but I'm such an Excel neophyte I don't know where to place the code.
    • ALT+F11.....to open the VBA editor
    • Right-click on your workbook's name in the Project list....Select: Insert Module
    • Copy the vba code I posted
    • Paste it into that module

    To use the code
    • Select the range of cells to be impacted
    • ALT+F8....To open the macro list
    • Select: ConvertCellTxt2FileLink
    • Click: Run

    Does that help?

  5. #5
    Registered User
    Join Date
    01-08-2009
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Create a Hyperlink Macro

    Holy Smokes! You're a genius! How do I learn how to do stuff like that? Is there a class I can take? Lol!
    Thank you sooo much for your help.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Create a Hyperlink Macro

    Thanks for the kind words....I'm glad I could help.

    Regarding learning Excel VBA:
    There are many books with various teaching approaches.
    Choose one that suits your learning style.

    THEN..(and this is important)
    Apply what you just learned in an aggressive project, not a little one-off project.

    Why?...Because an aggressive project will punish you mercilessly for any inefficiencies
    in structure or methodology. Thereby, ensuring that you don't develop any bad habits
    whose impact would be masked by a small project.

  7. #7
    Registered User
    Join Date
    01-08-2009
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Create a Hyperlink Macro

    Looks like I'll be heading over to Amazon to try to find a good book. Thanks for the help and advice.

+ 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