VBA compare range on multiple sheets

saetamortal

New Member
Joined
Jan 4, 2012
Messages
4
MasterSheet1 Range B:B has unique values like ID1, ID2, ID10000, etc.

There are 20 more sheets, named consecutively sheet2, sheet3,.. , sheet21. Each sheet represents a unique exclusive filter criteria, like sheet2 are all ID´s of items that are color "blue" and/or sheet3 has all the ID of green items. Items have only one color, so no ID should be repeated inside some sheet values and, more important, ID cannot be repeated across any of the 20 sheets.

Each of the 20 sheets has Range B:B containing a sub set (about 1000) of those Master sheet ID´s, since it is the origin of all ID´s.

I need a VBA button that prints on a new sheet, called reportsheet the following data columns:

MASTERIDTESTED (All values contained in mastertable should appear here), LOCATION (Full path address external), MATCHNUM (times the ID was found on any of the 20 sheets).

It is expected that one report record looks like the following:

If there is no match (meaning that particular ID has a color that is not on any of the 20 sheet) :
ID5, MasterSheet1!B5, matchnum 0.

If there is only one match one record is to be found:
ID6, Sheet18!B998, matchnum 1.

If there is more than one match, multiple records are to be found:
ID6, Sheet17!B605, matchnum 1.
ID6, Sheet18!B998, matchnum 2.
ID6, Sheet19!B300, matchnum 3.


So that is basically the code that you can enlighten me with :)
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,216,562
Messages
6,131,422
Members
449,651
Latest member
Jacobs22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top