I have a couple of VBA formulas that are causing me distress ...
&
The formulas work fine, but when I try to convert the VBA formulas to Evaluate, the evaluation gives error #VALUE!.
After the evaluation problem is solved, I will need to put the evaluation results down the range, for example D2:D2000 for the first formula.
VBA Code:
Part1 = "INDEX(Sheet2!$C$7:$C$" & LastRowSheet2 & ",AGGREGATE(15,6,ROW($A$1:$A$" & LastRowSheet2 & ")/(RIGHT(Sheet2!$C$7:$C$" & LastRowSheet2 & ",5)=""Total""),ROWS($1:1))),""-Total"","""""
Range("D2").Formula = "=IFERROR(IFERROR(VALUE(SUBSTITUTE(" & Part1 & ")),SUBSTITUTE(" & Part1 & ")),"""")" ' works
'' Range("D2").Value = Evaluate("IFERROR(IFERROR(VALUE(SUBSTITUTE(" & Part1 & ")),SUBSTITUTE(" & Part1 & ")),"""")") ' gives #VALUE! error
&
VBA Code:
Range("S2").Formula = "=IF(OFFSET($N$1,ROW()-1,MATCH((S$1*2),$N$1:$R$1,0)-1)=0,SUMPRODUCT(--('LastRowSheet2'!$A$7:$A$" & LastRowSheet2 & "='Sheet3'!$A2)*('Sheet2'!$C$7:$C$" & LastRowSheet2 & "=$D2)*('LastRowSheet2'!$I$7:$I$" & LastRowSheet2 & "=S$1*2)*('LastRowSheet2'!$L$7:$L$" & LastRowSheet2 & ")),0)" ' works
'' Range("S2").Value = Evaluate("IF(OFFSET($N$1,ROW()-1,MATCH((S$1*2),$N$1:$R$1,0)-1)=0,SUMPRODUCT(--('Sheet2'!$A$7:$A$" & LastRowSheet2 & "='Sheet3'!$A2)*('Sheet2'!$C$7:$C$" & LastRowSheet2 & "=$D2)*('Sheet2'!$I$7:$I$" & LastRowSheet2 & "=S$1*2)*('Sheet2'!$L$7:$L$" & LastRowSheet2 & ")),0)") ' gives #VALUE! error
The formulas work fine, but when I try to convert the VBA formulas to Evaluate, the evaluation gives error #VALUE!.
After the evaluation problem is solved, I will need to put the evaluation results down the range, for example D2:D2000 for the first formula.
Last edited: