vba to count
It seems to me you could use the DCOUNTA function here, since all you are
really doing is counting all the rows in Sheet2 with columns A-D matching the
criteria in Sheet3 columns A-D.
You will need to add column headers. I will use the column titles COL1,
COL2, COL3, COL4 (since I don't know what the data represents). Put these
headers over columns A-D in both sheets 2 and 3, and use some distinct
formatting so Excel can recognize them as titles.
Now you can use DCOUNTA:
=DCOUNTA(Sheet2!A:D,"COL4",Sheet3!A1:D2)
If I understood you correctly this will give the count you are looking for
without even needing any VBA.
"crabtree" wrote:
I need a VBA Code that will make the answer in Sheet1 A:1
do the following:
I have a table of data in Sheet2 A1:F50. I have four
values in Sheet3 Cells A1, B1, C1 and D1. I need the VBA
code to look down Sheet2 A1 and find all rows that match
Sheet3 A1. I then need it to further refine and look down
Sheet 2 B1 and pick only the rows that match Sheet3 B1.
Then, it needs to further refine and only pic the rows
whose value in Sheet2 C1 match Sheet3 C1. I then need it
to look out all the rows that match these criteria and
count the number of cells that contain the value in Sheet3
D1. Please help.
|