+ Reply to Thread
Results 1 to 9 of 9

Use VBA to auto Hyperlink files based on input

  1. #1
    Registered User
    Join Date
    01-17-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    23

    Post Use VBA to auto Hyperlink files based on input

    Hi all,
    I want to create a VBA macro (or sub or whatever it is called) that will automatically place a hyperlink in a chosen column based on data pulled from other cells in the row. My docs are now found on a server. Example: 5159.pdf. I need to be able to auto hyperlink at cell "B9" and so on after i select the drop list input at cell "B8" and key-in input in cell "A9" (Field Name - Doc. No.).

    Every time i key-in input at Doc. No., my hyperlink column start from "B9" onward would create the auto hyperlink

    Example hyperlink: \\servername\folder\<B8><doc.no>.pdf and text to display should be "Yes"
    Path \\server\folder\ should be hard coded or any.

    hyperlink.gif


    Really appreciated your help... Tq.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Use VBA to auto Hyperlink files based on input

    Try:

    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    01-17-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Use VBA to auto Hyperlink files based on input

    Tq OllyXLS,

    the code given to create the auto hyperlink and text to display is work. Tq so much.
    However the file extension doesn't appear after the doc. number ("A8") Example : \\fserver\folder\filelocation\5152.pdf
    2nd, if i delete the doc. number, the link still exist.
    3rd, if i drag or add new row to add more data, error popup as follows:-

    Run-time error '13'
    Type mismatch

    VBA Error - If Not Intersect(Target, Range("A8:A9999")) Is Nothing And Target.Value <> "" Then


    Appreciate your response ....

    Your kindness is highly appreciated.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Use VBA to auto Hyperlink files based on input

    No problems. Change the code to:

    Please Login or Register  to view this content.
    Does this work better?

  5. #5
    Registered User
    Join Date
    01-17-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    23

    Thumbs up Re: Use VBA to auto Hyperlink files based on input

    Great and workable ... Resolve
    Thanks a lot ..... Really appreciate it.
    Last edited by zulfaizan; 11-28-2013 at 12:24 AM. Reason: edit message

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Use VBA to auto Hyperlink files based on input

    Quote Originally Posted by zulfaizan View Post
    Great and workable ... Resolve
    Thanks a lot ..... Really appreciate it.
    Good, glad it does what you want

    You can mark this thread 'solved' now.

  7. #7
    Registered User
    Join Date
    01-17-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Use VBA to auto Hyperlink files based on input

    how to mark it .... i'm new here ...

  8. #8
    Registered User
    Join Date
    01-17-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Use VBA to auto Hyperlink files based on input

    Dear Olly,

    How can i recall the hyperlink based on sheetName.
    I got another sheet where the cell contains sheet name, path (file location) on Sheet Name call "LIST".
    The hyperlink auto created based on sheet name given.
    Example : "Sheet1" rename to "INC" ....

    Really appreciate your assistance ....


    Quote Originally Posted by Olly View Post
    Good, glad it does what you want

    You can mark this thread 'solved' now.

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Use VBA to auto Hyperlink files based on input

    Edit the line highlighted red:
    Please Login or Register  to view this content.
    You can make this anything you want. Your new question isn't specific enough to provide an actual specific answer for you, but it might look something like:
    Please Login or Register  to view this content.

+ 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. Auto filter based on input
    By AUSSIEHEDGE in forum Excel General
    Replies: 0
    Last Post: 02-20-2013, 12:32 AM
  2. Macro to auto-generate a hyperlink based on value
    By Biased Historian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2011, 07:37 PM
  3. Hyperlink points to address based on input from 2 cells
    By CKD777 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-15-2011, 04:18 PM
  4. Auto hyperlink to files???
    By mickey331 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-17-2011, 03:30 AM
  5. Playing .mp3 files based on user input
    By Maxi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2006, 10:35 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