A few words of thanks would be greatly appreciated.

Excel-VBA - Perform multiple selection


  • 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 costing (values) to the right.
    • In Sheet B I have a list of names with no casting (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 costing 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 that some names on Sheet B, may not appear on Sheet A and vice versa.


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


Thanks to Excelguru for this tip on the forum.

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Excel-VBA - Perform multiple selection », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!