Long time lurker, finally broke down and made an account (1st post).
I am in need of an if then statement in VBA. What i need it to do is count how many times each cell in Range B is in range A and does that count equal 10. the following is the formula that works in excel but not in VBA
=SUMPRODUCT(COUNTIF(RangeA,RangeB)=10
When using application.worksheetfunction in VBA i get the type mismatch error code and from my testing it seems its because VBA wants only a single criteria or cell reference in the Countif portion of the formula above.
Anyone have some alternatives that can be used instead?
Quick notes: Range A and B are made up for this example however Range A and Range B are on two difference worksheets for what its worth and both ranges are dynamic (while i know very little VBA i think i can manipulate any ideas you guys have to suit my own code).
I am in need of an if then statement in VBA. What i need it to do is count how many times each cell in Range B is in range A and does that count equal 10. the following is the formula that works in excel but not in VBA
=SUMPRODUCT(COUNTIF(RangeA,RangeB)=10
When using application.worksheetfunction in VBA i get the type mismatch error code and from my testing it seems its because VBA wants only a single criteria or cell reference in the Countif portion of the formula above.
Anyone have some alternatives that can be used instead?
Quick notes: Range A and B are made up for this example however Range A and Range B are on two difference worksheets for what its worth and both ranges are dynamic (while i know very little VBA i think i can manipulate any ideas you guys have to suit my own code).