X
Xlund
Hi,
I have a formula that works fine in my spreadsheet but when I try t
record it as a macro it no longer works.
Here's the formula that works:
=IF(IF(H2="40DV",INDEX('THC Table'!E:E,MATCH(C2,'TH
Table'!B:B,0)),IF(H2="40HC",INDEX('THC Table'!H:H,MATCH(C2,'TH
Table'!B:B,0)),IF(H2="20DV",INDEX('THC Table'!D,MATCH(C2,'TH
Table'!B:B,0)))))-T2=0,"ok","ERROR")
And here's the VBA code I get when I record the formula as a macro
which doesn't work (seems like the first "IF" statement doesn't ge
recorded):
Range("AC2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-21]=""40DV"",INDEX('TH
Table'!C[-24],MATCH(RC[-26],'TH
Table'!C[-27],0)),IF(RC[-21]=""40HC"",INDEX('TH
Table'!C[-21],MATCH(RC[-26],'TH
Table'!C[-27],0)),IF(RC[-21]=""20DV"",INDEX('TH
Table'!C[-25],MATCH(RC[-26],'THC Table'!C[-27],0)))))?"
Range("AC2").Select
Please help, thanks.:confused
I have a formula that works fine in my spreadsheet but when I try t
record it as a macro it no longer works.
Here's the formula that works:
=IF(IF(H2="40DV",INDEX('THC Table'!E:E,MATCH(C2,'TH
Table'!B:B,0)),IF(H2="40HC",INDEX('THC Table'!H:H,MATCH(C2,'TH
Table'!B:B,0)),IF(H2="20DV",INDEX('THC Table'!D,MATCH(C2,'TH
Table'!B:B,0)))))-T2=0,"ok","ERROR")
And here's the VBA code I get when I record the formula as a macro
which doesn't work (seems like the first "IF" statement doesn't ge
recorded):
Range("AC2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-21]=""40DV"",INDEX('TH
Table'!C[-24],MATCH(RC[-26],'TH
Table'!C[-27],0)),IF(RC[-21]=""40HC"",INDEX('TH
Table'!C[-21],MATCH(RC[-26],'TH
Table'!C[-27],0)),IF(RC[-21]=""20DV"",INDEX('TH
Table'!C[-25],MATCH(RC[-26],'THC Table'!C[-27],0)))))?"
Range("AC2").Select
Please help, thanks.:confused