Syntax Question - application.worksheetfunction.countifs how to refer to another workbook in VBA

Loun

New Member
Joined
Dec 29, 2012
Messages
28
Hi All,

I managed to get this worksheetfunction.Countifs to work yesterday (Thanks to Jonmo for the solution!)

however, I now need to amend part of the Countifs formula so that the range is in another workbook. I can't seem to get the syntax right.

here is the formula



x = Application.Countifs(Range("$B$2:$B$96"),Cells(ActiveCell.Row,"B"),Range("$C$2:$C$96"),Cels(ActiveCell.Row,"C"))
If x > 1 Then

Basically the b2:b96 portion and the c2:c96 portion I need to refer to a separate workbook (called Test.xlsm). The rest of the formula would remain the same.

Can anybody help please? I've tried using the recorder but it uses R1C1 formula rather than application.worksheetfunction (as I want the calculation to be internal) and I've had no joy with it.

Many thanks,

Lou
 

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,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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