我只是想知道如何在VBA中使用IF公式。这是我目前拥有的公式,但是它给了我错误。"语句结束"
Range("a10").Select
Selection.End(xlDown).Select
lastrow = ActiveCell.Row
For i = 10 To lastrow
Sheets("20140618 Loans").Range("Z" & i).Formula = _
"=IF(ABS("Y" & i)>400,""CHECK"","""")"
有什么想法吗?感谢。
答案 0 :(得分:3)
Range("a10").Select
Selection.End(xlDown).Select
lastrow = ActiveCell.Row
For i = 10 To lastrow
Sheets("20140618 Loans").Range("Z" & i).FormulaR1C1 = "=IF(ABS(R1C" & i &")>400,""CHECK"","""")"
答案 1 :(得分:3)
所以你需要这样做:
Sheets("20140618 Loans").Range("Z" & i).Formula = _
"=IF(ABS(Y" & i & ")>400,""CHECK"","""")"