我收到基于代码底线的运行时错误“1004”。如果我“结束”并重新运行,问题就不会出现。
我只包含了相关代码,因为我有很多变量,if 和格式化代码。
Dim Yeild As String
Sub NewPage()
'...
Yeild = "=INDEX(AcreGrid,MATCH(" & Chr(34) & Comm & Chr(34) & _
",Prod!R3C1:R30C1,),MATCH(" & Chr(34) & Season & Chr(34) & _
",Prod!R3C1:R3C16,))/" & ActiveCell.Offset(0, 3)
'... the above formula has been giving me the most problems
ActiveCell.Offset(0, 3).Formula = "=Vlookup(B" & ActiveCell.Row & ", EQF,5,)" 'Factor
'... I didn't define the above formula because it was causing problems
ActiveCell.Offset(0, 7) = Yeild
'...
End Sub
我也尝试了以下方法,但单元格参考 B4 更改为“B4”;导致#NAME?Excel 中的错误。
Yeild = "=INDEX(AcreGrid,MATCH(" & Chr(34) & Comm & Chr(34) & _
",Prod!R3C1:R30C1,),MATCH(" & Chr(34) & Season & Chr(34) & _
",Prod!R3C1:R3C16,))/Vlookup(B" & ActiveCell.Row & ", EQF,5,)"
ActiveCell.Offset(0, 7) = Yeild
任何帮助将不胜感激。