• 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...

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

PLEASE ADVISE: VBA MACRO - combing two excel sheets into One

Marketa

New Member
Hi, I would like to combine two excel sheets into one as follows:
Sheet 1:
Column A: Name
Column B: Role

Sheet 2:
Column A: Role
Column B: T- Code

Sheet after macro:
Column A: Name
Column B: Role
Column C: T-Code

The problem is that 1 Name hase more than 1 roles and one Role has more than 1 T-codes. The number of roles and T-Codes is never the same, so I need to count the number of T-Codes per role and add the number of rows under one name and insert the matching t-codes.

Thanks!

Marketa
 

Attachments

  • DEMO2.xlsx
    10.9 KB · Views: 2
Hi Marketa,

As per your query i have done the VBA code, check the attached workbook and run the macro.

Regards
Abdul Matheen
 

Attachments

  • DEMO2.xlsm
    18.1 KB · Views: 4
Hi Abdul,

I tried to copy the macro into my sheet with real data, but after running it, the third sheet called "after macro" stays blank. There are 59 users and 453 roles with T-codes. Can you please advise?

Thanks!

Marketa
 
Please take this one. I made a little change in the file. Thanks!
 

Attachments

  • 2100_SoD_Roles and T-Codes.xlsx
    26.1 KB · Views: 3

Hi,

no needs a code !
In Users worksheet, just enter this formula in cell D3 : =VLOOKUP(C3,Roles!$B$3:$C$455,2,FALSE)
Copy it down and, voilà !

Regards !
 
Back
Top