PDA

View Full Version : Copy and paste in VBA



hashforth
11-22-2011, 06:19 PM
Hi,

I am new to VBA and some help with a macro would be great! Attached is data that models my problem. Ideally, I would like the macro to recognize the value in the drop down menu in sheet2 cell B2 and pull in the corresponding data associated with that value from sheet1. Ideally, the macro would copy and paste the data in sheet1 to sheet2 to match the column headings for that particular value in sheet2 cell B2. So for example:

Sheet 1: Data set

A B C
Filing Date Company Name Revenue
1/1/2000 ABC, Inc. 1234
4/14/2008 FGH, Inc. 5678
4/6/2005 DEF, Inc. 5664
7/7/1999 ABC, Inc. 1356
5/8/2010 XYZ, Inc. 6456
5/8/2010 ABC, Inc. 3213
1/23/2005 FGH, Inc. 8546
4/5/2006 FGH, Inc. 2133
12/25/2010 ABC, Inc. 5466
11/13/2010 ABC, Inc. 5465


Sheet 2: "ABC, Inc." is selected in the drop down menu in cell B2:


B
Drop Down
ABC, Inc.


After the macro fires, the result on sheet2 is:

E F G
Filing Date Company Name Revenue
1/1/2000 ABC, Inc. 1234
7/7/1999 ABC, Inc. 1356
5/8/2010 ABC, Inc. 3213
12/25/2010 ABC, Inc. 5466
11/13/2010 ABC, Inc. 5465


If I need to be more specific or provide any additional information please let me know. I am indeed new to VBA.

Thanks!