Excel Multi select VBA Coding

Solved/Closed
LakeShow - Jun 10, 2009 at 04:55 AM
 rohit - Dec 11, 2009 at 02:07 AM
Hello,

I have a VBA problem that I cannot seem to get my head round. I have two sheets (aptly named A and B).

In Sheet A I have a list of names with costings (values) to the right.
In Sheet B I have a list of names with no costings (values) to the right.

I would like to design a Macro that will take the first name in Sheet A, find that name in Sheet B, copy the costings associated with that name in Sheet A and paste them in Sheet B.

From there, the Macro should proceed to select the next name down on Sheet A, and do the same.

So it would be a loop until the names on Sheet A are done.

Please not thatm some names on Sheet B, may not appear on Sheet A and vice versa

Thank you in advance
Related:

1 response

Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 307
Jun 10, 2009 at 07:35 AM
Hi

you can do it without a macro
Put the following formula in cell B1 of sheet 2 (Assumes the name is in column A)
=if(iserror(vlookup(A1,sheet1!A:A,2,false) ),"",vlookup(A1,sheet1!A:A,2,false)) and drag it down

If you want a macro record your above activity
2
Hey thanks for that. I ended up using the Index & Match function which worked well.

Awesome!!
0
rohit > LakeShow
Dec 11, 2009 at 02:07 AM
you can try this part of the code dude

=if(iserror(vlookup(A1,sheet1!A:A,2,false) ),"",vlookup(A1,sheet1!A:A,2,false))
0