Refer to range in another worksheet COUNTIFS

YasserKhalil
PlatinumLounger
Posts: 4911
Joined: 31 Aug 2016, 09:02

Refer to range in another worksheet COUNTIFS

Post by YasserKhalil »

Hello everyone

I am trying to do such Application Countifs like that

Code: Select all

Application.WorksheetFunction.CountIfs(sh.Range("C2:C" & lr), sGrade, sh.Range("D2:D" & lr), sClass, rngDateCol, Chr(34) & sAbsent & Chr(34))
And the rngDateCol is set to be

Code: Select all

Set rngDateCol = sh.Range(sh.Cells(3, x), sh.Cells(lr, x))
But the line throws an error Unable to get Countifs property of the worksheetfunction clas

YasserKhalil
PlatinumLounger
Posts: 4911
Joined: 31 Aug 2016, 09:02

Re: Refer to range in another worksheet COUNTIFS

Post by YasserKhalil »

I found the fault. it is the number 3 should be 2
sh.Cells(3, x)

Regards