+ Reply to Thread
Results 1 to 16 of 16

Macro to enter vlookup in cells in a column but only if specified cell is filled in

  1. #1
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Question Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Hi, this is my first post to the forum.
    I am looking for some help with a macro that I have been making linking four spreadsheets together. I am struggling with two spreadsheets in particular.When a value is put into a certain cell in one spreadsheet, I would like this to update another worksheet when the macro is run using a part number as a unique identifier. I am currently using a vlookup to do this but i have a problem in that i only want to perform the vlookup on those cells that have a date in a specific column on that spreadsheet, otherwise it will override information that was already input onto the spreadsheet from other sources. Have been looking at this for a while so any help would be appreciated. Kind regards, Tanya

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    hi Tanyab, welcome to Excelforum, please check attachment file created basing on your thread title, press Fill button or run code test. If that's not you are after, please post sample workbook explaining the issue
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Talking Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Wow what a quick response, thank you! I will try the coding tomorrow and repost. Once again thank you.

  4. #4
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Question Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    That macro you supplied was very useful however, it does not fulfil exactly what I would like. I have further explained the situation below and attached an example. Thank you so much for your help in advance!

    Please see attached the example that I have created. Sheet 1 is the master.Sheet 2 is the sheet that will be used to keep track of a disposition (column B) for some of the numbers contained on sheet 1. I would like Sheet 2 to perform a vlookup (using column A as an identifier) to update the values in the 'Disposition' column in Sheet 1, but ONLY if Column F in Sheet 1 has a date within it. If this column has a N/A or is blank, I would like the value to stay as it was and not have the vlookup formula put in it.

    Is this possible?
    Kind regards,
    TanyaEXAMPLE.xlsx

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    is it a mistaken column specified:
    ONLY if Column F in Sheet 1 has a date within it.
    The F column on Sheet1 is empty

  6. #6
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Exclamation Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Quote Originally Posted by watersev View Post
    is it a mistaken column specified: The F column on Sheet1 is empty
    Yes that is a mistake, apologies for that. It should be only if Column C on sheet 1 has a date within it.

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    please check attachment, press "Update" button or run code "test"
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Hi,

    The code you have supplied is EXACTLY what I need. Thank you. I am struggling to be able to amend this to fit my actual spreadsheet though. I have attached a copy of the spreadsheet that I will be adding the macro to (and taken off all irrelevant data). Of the two spreadsheets, 'Non-conformance Data' sheet is the working sheet in which column Q will be used to record the disposition. I would like this (when the macro is run) to update column AI on the 'Master' sheet, but only if column AA (on 'Master' sheet) has a date in it. I would like it to use column U on the 'Master' sheet and column B on the 'Non-conformance Data' sheet at the unique identifier of which to correspond the disposition. In summary, the macro you have supplied is perfect, but because I am a novice, I don't quite understand it all to be able to amend it to suit my spreadsheet in terms of references. Therefore, are you able to help me?

    Help is much appreciated!

    Kind regards.
    EXAMPLE3.xlsx

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    please check attachment, press "Update" button or run code "test"
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    I would like the 'Non-conformance' sheet to update the 'Master' sheet if possible. At the moment, the 'Master' is updating the 'Non-conformance' sheet.

    It really will make my day if you can make this work!

    Kind regards.

  11. #11
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    please check attachment, run code "test"
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    That works perfectly! Thank you so much for ALL your help!!

  13. #13
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Hi, ever so sorry, I have just put the macro on my master sheet and it deletes data that is in the cell already (if the MDR number from the 'Non-conformance sheet' cannot be found in the MDR Number column on the 'Master' sheet then I do not want this to change the value that is in the disposition cell on the 'Master' sheet already. At the moment, it deletes what was in there and leaves it blank if it cannot find it.

  14. #14
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Hi, Please ignore the previous message. It works!!! Thank you

  15. #15
    Registered User
    Join Date
    01-03-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    Hi, I have another query in regards to the coding above- where the code puts the end result-if this cell is blank then I woudl like it to input the result, if not, I woudl like it to leave what was in there before. Is this possible?

    Kind regards,
    Tanya

  16. #16
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to enter vlookup in cells in a column but only if specified cell is filled in

    please check attachment, run code "test" or press "Update" button
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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