G
Guest
Hi. I'm new to Excel macros, but not Excel. Trying to write a macro to do
the following, but I'm not sure how.
Worksheet 1, Columns A & B contain first and last names. Column C is
currently blank.
Worksheet 2, Columns A & B contain first and last names. Column C contains
cost.
Worksheet 2 contains only some of the names in Worksheet 1.
Want a macro to compare first and last names of the two worksheets. When
they match, take the cost in Worksheet 2 and place it in Column C of
Worksheet 1. When they don't match, move onto the next name in Worksheet 1
until end of data.
Here's the next kicker:
Some of the rows in Worksheet 2 contain information on the same name. For
example, Jane Doe may have 2 rows of information for cost, which would need
to be added together and put in Column C on worksheet 1.
For example,
Worksheet 1:
Jane Doe
Joe Smith
Ted Blake
Hank Walters
Worksheet 2:
Joe Smith $35.00
Jane Doe $15.00
Hank Walters $5.00
Jane Doe $10.00
Worksheet 1 Result after Macro Runs:
Jane Doe $25.00
Joe Smith $35.00
Ted Blake
Hank Walters $5.00
I think I would use a do...while loop, but don't understand how to reference
multiple worksheets or even attempt the kicker part.
Any help would be greatly appreciated!
Thanks in advance,
Julz
the following, but I'm not sure how.
Worksheet 1, Columns A & B contain first and last names. Column C is
currently blank.
Worksheet 2, Columns A & B contain first and last names. Column C contains
cost.
Worksheet 2 contains only some of the names in Worksheet 1.
Want a macro to compare first and last names of the two worksheets. When
they match, take the cost in Worksheet 2 and place it in Column C of
Worksheet 1. When they don't match, move onto the next name in Worksheet 1
until end of data.
Here's the next kicker:
Some of the rows in Worksheet 2 contain information on the same name. For
example, Jane Doe may have 2 rows of information for cost, which would need
to be added together and put in Column C on worksheet 1.
For example,
Worksheet 1:
Jane Doe
Joe Smith
Ted Blake
Hank Walters
Worksheet 2:
Joe Smith $35.00
Jane Doe $15.00
Hank Walters $5.00
Jane Doe $10.00
Worksheet 1 Result after Macro Runs:
Jane Doe $25.00
Joe Smith $35.00
Ted Blake
Hank Walters $5.00
I think I would use a do...while loop, but don't understand how to reference
multiple worksheets or even attempt the kicker part.
Any help would be greatly appreciated!
Thanks in advance,
Julz