+ Reply to Thread
Results 1 to 4 of 4

VBA code to diplay a file path in a cell based on another cell value

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    England
    MS-Off Ver
    Excel 2007 & Excel 2011 for Mac
    Posts
    79

    VBA code to diplay a file path in a cell based on another cell value

    Hi,
    I am trying to find any code that will help me do the following but am coming up stuck at the moment. Basically I have UDF in a workbook that, based on a file path in a specific cell, woul load a JPG into the worksheet.

    For example

    A1 contains the file path (c:\dropbox\folder\PDH.jpg)
    C1 contains the formula =Insertpic(A1)

    This all works fine but what I need is to be able to change the PDH.jpg part of the file path name depending on a lookup based on another cell value.

    For example

    E1 could contain the letters NC in which case I would need the file path to change to c:\dropbox\folder\NC.jpg or they could contain GNI in which case i would need c:\dropbox\folder\GNI.jpg

    Any help would be appreciated

    Many Thanks

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA code to diplay a file path in a cell based on another cell value

    Maybe this way?

    a1 =c:\dropbox\folder\
    b1 =GNI
    c1=a1&b1&".jpg"
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    03-25-2012
    Location
    England
    MS-Off Ver
    Excel 2007 & Excel 2011 for Mac
    Posts
    79

    Re: VBA code to diplay a file path in a cell based on another cell value

    Quote Originally Posted by oeldere View Post
    Maybe this way?

    a1 =c:\dropbox\folder\
    b1 =GNI
    c1=a1&b1&".jpg"

    So simple but it works

    Many Thanks

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA code to diplay a file path in a cell based on another cell value

    Glad I could help. Thanks for the reply.

    If the question is solved, will you mark your question as solved?

    If you have (other) questions, just ask.

+ 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