VBA loop through 2 columns and perform action

  • I have 2 lists in my excel: column b with country name and column c with country code.
    Step 1: go through list in column c and copy it to specific places in sheet 2 and sheet 3
    Step 2: create a new workbook with corresponding b value as the same and copy sheet 2 and sheet 3 into this new workbook.
    Example:
    Col b col c
    Germany 23
    Italy 42

    • Excel copies 23 to sheet 2 and 3(in specific cells). Then creates a new workbook in path with name Germany.
    • Excel copies 2 to sheet 2 and 3 (in specific cells). Then creates a new workbook in path with name Italy.


  • Code Tags Added
    Your post does not comply with our Forum RULES. Use code tags around code.


    Posting code between

    Code

    tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.


    Highlight your code and click the # icon at the top of your post window.


    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!