尝试将以下公式插入AS列时,我收到以下错误消息。
运行时错误' 1004': 法' "范围"对象' _Global'失败
有人可以对我的代码嗤之以鼻,并说出任何错误吗?我在这里疯狂。
Sub Zero_Dollar_Opps()
Dim LastRow As Long
LastRow = Cells(Rows.Count, 2).End(xlUp).Row
'name last column $0 Opps
Range("AS1").Value = "$0 Opps"
'insert formula for $0 Opps
Range("AS2:AS" & LastRow).Formula = "=IF(AND(AP2=0,(OR(AL2=""1 -
Qualifying"", AL2=""2 - Validating"", AL2=""3 - Proposing"", AL2=""4 -
Negotiating""))),1,0)"
End Sub
感谢Stackoverflow社区!
答案 0 :(得分:0)
也许:
Sub Zero_Dollar_Opps()
Dim LastRow As Long
LastRow = Cells(Rows.Count, 2).End(xlUp).Row
'name last column $0 Opps
Range("AS1").Value = "$0 Opps"
'insert formula for $0 Opps
Range("AS2:AS" & LastRow).Formula = "=IF(AND(AP2=0,(OR(AL2=""1 - Qualifying"", AL2=""2 - Validating"", AL2=""3 - Proposing"", AL2=""4 -Negotiating""))),1,0)"
End Sub
答案 1 :(得分:0)
解决。今天早上尝试使用相同的代码并且没有收到任何错误消息。我知道我讨厌VBA的原因..