Excel/Macro Help



I am trying to create a macro to help me with a comparison.

I have 2 excel documents, each have one column which is similar (a code ID). I am trying to match up the code IDs from document 1 and document 2 and if there is a match create a new tab (for all the matches) and paste the code ID as well as another column (price) from document 2.

Any help would be greatly appreciated.


If this is a one off, I wouldn't even bother with a macro- I'd just use the vlookup function to lookup the price from document 2 - any cells returning the #N/A error are not matches and can be filtered out, the rest copied and pasted to the new tab.

It would be perfectly possible to write a macro, but it may be just as quick - even if not a one off, to do the above process?  If you definitely need a macro then I'm happy to write one!
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Aidan Heritage


I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!


My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2017 About.com. All rights reserved.