1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code vlookup column and paste value in specified headers

Discussion in 'VBA Macros' started by Laximikant Naik, Mar 11, 2019.

  1. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    I am new to VBA, I need a code to perform a certain task. I have uploaded a file that explains everything.

    Attached Files:

  2. charlesdh

    charlesdh Member

    Messages:
    79
    Lax,

    In the "Master" sheet where does "Type" and "Temp" come from?
    Also, "Dimension" in data sheet. and too, provide what the data in the "Master" sheet that meet your request.
    Last edited: Mar 12, 2019
  3. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    Hi Charles,

    Thanks for your response!

    "Master" Sheet will comprise series of attribute headers which may or may not exist in "Delimited/data" sheet. U just have to concentrate on "delimited" and "data" sheets where vlook up matches of cells just paste in matching headers of "master sheet. I have attached Master sheet i need after the macro runs. just refer master sheet.

    Attached Files:

  4. charlesdh

    charlesdh Member

    Messages:
    79
    Lax,
    Here's a copy that I think you want. If not Please correct to let use know what the "Master" should show.

    Attached Files:

  5. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    1. There are 4 Part numbers in this case. Normally it can be any number of Part numbers
    2. Macro will always start from cell B2. Vlookup content of Cell B2 from "Delimited" sheet with data in A &
    B column of "Data" sheet. In this case Vlookup "GRM" with A & B column of "Data" sheet, you will get "SMD" as a result. Paste this result (SMD) to Column header of Column B, that is "Mounting". Search Column header of B "Mounting" in "Master" sheet and Paste the result "SMD" in first cell of "Mounting" column in Master sheet.
    3. Now in "Delimited" sheet move to next column C and repeat the vlookup activity. In this case vlook up 32
    with column C & D of "Data" sheet and paste the result "32 Pins" by searching column header of C column in "Delimited" sheet "No of Pins" in Master sheet and paste it in first cell of that column.
    4.Next move to D column and Vlook up "F" in "Delimited" sheet with E and F column of "Data" sheet and paste the result "1" in column header of D "Tolerance" by searching it in Master sheet by pasting it in first cell.

    5.Now move to next part number and repeat the same steps as above. Like wise do it for all part numbers

    6.if any charatcer in "delimited" columns does not match with their lookup table , highlight that part number in "Delimited" sheet

    7. This macro should be dynamic in range. Part numbers can be multiple characters. Delimiting can be into multiple columns but in same sequence as in this case. Similarly headers can be anything. If header matches with any header in Master sheet, then only paste data. Otherwise ignore

    refer to attached sheet for example explained above

    Attached Files:

  6. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    hello Charles ,

    Any updates on the above query
  7. charlesdh

    charlesdh Member

    Messages:
    79
    Lax,
    Sorry for the delay. I've been lookin at your file trying to determine
    the reason for code.
    You have 3 sheets. You can actually narrow that to 2 sheets. "Delimited" and "Master". I reformatted the "Delimited" sheet.
    But, for the project I can not see why you are doing this. There must be something I'm missing as to your logic.

    Attached Files:

  8. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    Hello Charles,

    Thanks for your reply.

    Actually solution provided by you also will be fine. If you can provide VBA macro code for performing the activity of copying data as per the delimited char. Also just take care that code should be dynamic. As delimited data can be anything. But the column pattern will be same
  9. Laximikant Naik

    Laximikant Naik New Member

    Messages:
    6
    Hello Charles,

    Let me know if you need more information

    Regards
    Lax

Share This Page