0
.Range("BS2:BS" & NewLastRow).Formula = "=IF((OR(BR2=""FLAG"",BO2>0)),""FLAG"",""NOFLAG""))"
我在VBA中使用此公式,但它不起作用。語法看起來很好。與VBA中的IF/OR錯誤
.Range("BS2:BS" & NewLastRow).Formula = "=IF((OR(BR2=""FLAG"",BO2>0)),""FLAG"",""NOFLAG""))"
我在VBA中使用此公式,但它不起作用。語法看起來很好。與VBA中的IF/OR錯誤
太多 「)」
.Range("BS2:BS" & NewLastRow).Formula = "=IF(OR(BR2=""FLAG"",BO2>0),""FLAG"",""NOFLAG"")"
在一般情況下,請嘗試以下操作:
Public Sub PrintMeUsefulFormula()
Dim strFormula As String
Dim strParenth As String
strParenth = """"
strFormula = Selection.Formula
strFormula = Replace(strFormula, """", """""")
strFormula = strParenth & strFormula & strParenth
Debug.Print strFormula
End Sub