Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro referencing multiple worksheets

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 219
Default Macro referencing multiple worksheets

Use the SumIf( ) function in worksheet 1 column C
HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Julz" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import multiple text files (Macro) Thr33of4 Excel Discussion (Misc queries) 0 September 19th 06 02:19 AM
Display data from multiple worksheets' cells in one worksheet J! Excel Worksheet Functions 1 August 29th 06 08:53 PM
Formula Referencing data on multiple worksheets ChrisPrather Excel Worksheet Functions 6 August 22nd 06 05:14 AM
Functions across multiple worksheets starlight Excel Worksheet Functions 0 August 10th 05 05:10 PM
Summary worksheet referencing multiple worksheets Jon Excel Worksheet Functions 1 January 27th 05 01:12 AM


All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"