Actually, you don't want to put this into a Worksheet_Change or SelectionChange event, otherwise it will continuously update and you'll end up with huge strings in column B (e.g. No Match: 77 No Match: 77 No Match: 77....)
Keep the code below as a separate function (I modified it to check Column A for the bottom row of text rather than column B so it checks every cell in column B that has a value in Column A.)
To insert this code in Excel 2007, use either the Developer ribbon bar or simply press ALT+F11 to open the Visual Basic editor.
Next, expand the 'VBA Projects (yourworkbookname)' tree until you see 'Sheet1', 'Sheet2', 'ThisWorkbook'.
Next, double-click on the sheet you want the code to run on and paste this code into the whitespace on the right.
Finally, close the VBA window to return to Excel.
Your options for running the macro are:
1) Manually through the Macros window (View or Developer ribbon bars, or press ALT+F8)
2) This option looks longer, but after the initial setup it will save you time in the future... Attach the macro to a command button on your sheet to run it at the click of a button. On the Developer ribbon bar, in the Controls section, click the Insert button and select the Command Button icon (should be first one under Form controls). Draw a rectangle on the sheet where you want the button. Once you do, you should be prompted with the 'Assign Macro' window. Select your 'FindMatches' macro and click OK. You can then click on the button and change the text shown to something other than "Button 1". Turn off Design Mode by clicking the button in the Developer-Controls ribbon bar and you're all set in the future to type or paste data into column B then click your button.
Bookmarks