I'm trying to set the formula of a cell based on certain criteria. Like this:
That's giving me an error:
"Unable to set the FormulaArray property of the Range class."
So how would I set it then?
Code:
If ActiveSheet.Range("K1") = "Cell 200" Then
mVar1 = "E4:E11"
mVar2 = "I4:I11"
mVar3 = "M4:M11"
mVar4 = "Q4:Q11"
mVar5 = "U4:U11"
End If
... More If statements here ...
ActiveSheet.Range("B4").FormulaArray = "=MEDIAN(IF(Week1!" & mVar1 & "<>0,Week1!" & mVar1 & "))"
ActiveSheet.Range("C4").FormulaArray = "=MEDIAN(IF(Week1!" & mVar2 & "<>0,Week1!" & mVar2 & "))"
ActiveSheet.Range("D4").FormulaArray = "=MEDIAN(IF(Week1!" & mVar3 & "<>0,Week1!" & mVar3 & "))"
ActiveSheet.Range("E4").FormulaArray = "=MEDIAN(IF(Week1!" & mVar4 & "<>0,Week1!" & mVar4 & "))"
ActiveSheet.Range("F4").FormulaArray = "=MEDIAN(IF(Week1!" & mVar5 & "<>0,Week1!" & mVar5 & "))"
That's giving me an error:
"Unable to set the FormulaArray property of the Range class."
So how would I set it then?