+ Reply to Thread
Results 1 to 10 of 10

VBA to link to folder on my network using the contents as a cell as part of the address.

Hybrid View

  1. #1
    Registered User
    Join Date
    05-12-2017
    Location
    Kent, England
    MS-Off Ver
    2016
    Posts
    23

    VBA to link to folder on my network using the contents as a cell as part of the address.

    Okay, I don't even know if this is possible as I have barely even used =HYPERLINK in the past let alone hyper link VBA code.

    What I want to achieve is a link to a folder on my network, the final part of the address will be the same as the contents of another cell. So column A contains a list of course numbers, coulmnt T would need to link to w://medcourses/"contents of same row in column A" with the link name of 'Link to Cases' So clicking this link would just open that folder in windows explorer.

    As I say, I am not sure this is possible, i can't even find anything close on the web so you guys are my last throw of the dice.

  2. #2
    Registered User
    Join Date
    05-12-2017
    Location
    Kent, England
    MS-Off Ver
    2016
    Posts
    23

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    I am a little hopeful that I may have found the key to my solution, but I haven't been able to get it to work on my spreadsheet. I have found the following code online but can't quite translate it to solve my problem....

    Option Explicit 
    Private Sub Worksheet_Change(ByVal Target As  Range) 
        If Target.Column = 12 And Not Target.Value = "" Then 
            Application.EnableEvents = False 
            Hyperlinks.Add Target, Address:="http://www.google.com/search?q=" & Target.Value, TextToDisplay:="Click Here" 
            Application.EnableEvents = True 
        End If 
    End Sub

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    Can you provide a worksheet with a row or 2 of data, and indicate the desired hyperlink for each?

    Also, you posted a worksheet event as the example, if that is what you want, what exactly should trigger the event? Or do you just want a regular macro?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Registered User
    Join Date
    05-12-2017
    Location
    Kent, England
    MS-Off Ver
    2016
    Posts
    23
    Quote Originally Posted by Arkadi View Post
    Can you provide a worksheet with a row or 2 of data, and indicate the desired hyperlink for each?

    Also, you posted a worksheet event as the example, if that is what you want, what exactly should trigger the event? Or do you just want a regular macro?

    Basically column A is a numeric reference to a course and columns b to s contain data relating to the course. Once data is entered into column A i would like column T to auto populate with a hyperlink to the folder on w: (i.e. w:\12345) 12345 being the folder name on w: and the contents of A

    I can post a sample tomorrow when back at work.

    Thanks
    Last edited by Medimatt; 05-24-2017 at 03:30 AM.

  5. #5
    Registered User
    Join Date
    05-12-2017
    Location
    Kent, England
    MS-Off Ver
    2016
    Posts
    23

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    also, I would like the event triggered when the cell in column a is populated

    Thanks

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    You may find this thread of interest.
    https://www.excelforum.com/excel-gen...ml#post4661447
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    Here is an excellent source of valuable Excel and VBA advice - and this page deals specifically with hyperlinks

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    You do not require VBA to create links
    I created folder medcourses on my D drive
    If values in column A are folder names, this formula opens the folder specified in cell A2
    Formula: copy to clipboard
    =HYPERLINK("D:\medcourses\"&A2,"Link To Cases")


    Had you wanted to open an Excel file specified in cell A2, then this would work
    Formula: copy to clipboard
    =HYPERLINK("D:\medcourses\"&A2&".xlsx","Link To Cases")


    note:
    I am not network savvy, but if your drive is not mapped, I believe the link string takes this pattern
    \\MyServer\MyFolder\
    Attached Files Attached Files
    Last edited by kev_; 05-30-2017 at 05:23 AM.

  9. #9
    Registered User
    Join Date
    05-12-2017
    Location
    Kent, England
    MS-Off Ver
    2016
    Posts
    23

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    Kev_, I guess I was trying to be too clever. I tried formulas originally but must have got something wrong and assumed i needed a macro. For the first time ever I can't actually think of anything that will improve my spreadsheet! Thank you very much.

  10. #10
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA to link to folder on my network using the contents as a cell as part of the addres

    You are welcome
    Thanks for marking the thread as SOLVED

+ 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. VBA to open folder on the network based on data from the active cell
    By s0o0y in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2013, 04:38 PM
  2. [SOLVED] reference part of cell address from button and part of another cell
    By JJGF in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-24-2012, 04:48 PM
  3. Replies: 2
    Last Post: 03-01-2012, 06:17 AM
  4. Replies: 4
    Last Post: 01-29-2010, 01:19 PM
  5. Using a cells contents as part of an address in a function
    By bdemski in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2007, 11:05 PM
  6. creating a network cell link
    By diepenbos in forum Excel General
    Replies: 0
    Last Post: 09-09-2005, 10:27 AM
  7. Replies: 0
    Last Post: 07-20-2005, 08:05 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