beedistinct
Board Regular
- Joined
- Jun 24, 2011
- Messages
- 62
I'm using the following in a macro and it seems that none of the criteria match, so while running the macro it gives me a run-Time error '1004'. "Unable to get the AverageIfs property of the WorksheetFunction class". How to handle this? I need to treat the average as a zero when the criteria doesn't match.
Average = WorksheetFunction.AverageIfs(AverageRange, Range, ">12/31/2009", Range, "<1/1/2011", StateRange, "<>Buy", StateRange, "<>Created", UrgentRange, "Urgent", ConditionRange, "<>")
Average = WorksheetFunction.AverageIfs(AverageRange, Range, ">12/31/2009", Range, "<1/1/2011", StateRange, "<>Buy", StateRange, "<>Created", UrgentRange, "Urgent", ConditionRange, "<>")