+ Reply to Thread
Results 1 to 5 of 5

Macro to combine and return values

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    Tokyo
    MS-Off Ver
    Excel 2003
    Posts
    10

    Macro to combine and return values

    Hello everyone,

    I am very new to this and would like some help with a code.

    I have attached the sample workbook, and I am pasting the code I have made so far below.

    However, I have no idea of how to code the next part.

    Basically I want the macro to return this value in cells E2:E11:
    「(value in Data Processing!F2) + "\" + (Value in RC[-1]) + ".jpg"」
    But only if the previous cell contains value.

    Please give me your advice & solutions!

    SAMPLE.xlsx

    Code I have:

    Please Login or Register  to view this content.
    Last edited by Cutter; 08-24-2012 at 10:49 AM. Reason: Added code tags

  2. #2
    Registered User
    Join Date
    08-22-2012
    Location
    Tokyo
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Macro to combine and return values

    Maybe I should clarify that when I write "But only if the previous cell contains value"

    I mean:

    "only if the cell in the same row of the previous column contains a value"

    thanks

  3. #3
    Registered User
    Join Date
    03-01-2011
    Location
    Bergen, Norway
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro to combine and return values

    Hi,

    Place this code in the VBA module for the sheet "Result"
    The code will trigger whenever you enter anything inside that sheet, but will check to make sure
    that it only executes when you do anything inside tha range D2:D11.
    If you erase the contents of the cell, then the cell in the E column will also be erased.

    Regards
    Olav
    They don't make bugs like Bunny anymore


    Please Login or Register  to view this content.
    Last edited by Cutter; 08-24-2012 at 10:48 AM. Reason: Added code tags

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to combine and return values

    @ meleo and olav

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  5. #5
    Registered User
    Join Date
    08-22-2012
    Location
    Tokyo
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Macro to combine and return values

    Hi Olav,

    How do I place the code in the VBA module?
    Maybe I am doing it wrong.

    I went to the sheet "result", opened Visual Basic then pasted your code in there and saved.
    However, nothing happens in the Photo File column when I run my macro.

    Many thanks,
    Dario

+ 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