Vba 列乘法循环中的运行时错误1004
我设计了一个代码,使用if-else语句将两列相乘,但是我在Vba 列乘法循环中的运行时错误1004,vba,excel,Vba,Excel,我设计了一个代码,使用if-else语句将两列相乘,但是我在L=Cells(I,“L”)上得到了一个错误1004。Value因此我需要澄清为什么会发生这种情况。 这是密码 Sub IfCalculationEq1() Dim lastrow As Long Application.ScreenUpdating = False Dim i As Long Dim L As Long Dim E As Long lastrow = Cells(
L=Cells(I,“L”)上得到了一个错误1004
。Value
因此我需要澄清为什么会发生这种情况。
这是密码
Sub IfCalculationEq1()
Dim lastrow As Long
Application.ScreenUpdating = False
Dim i As Long
Dim L As Long
Dim E As Long
lastrow = Cells(Rows.Count, "L").End(xlUp).Row
L = Cells(i, "L").Value
E = Cells(i, "E").Value
For i = 3 To lastrow
If Cells(i, "K").Value = "-" Then
Cells(i, "N").Value = "-"
Else
Cells(i, "N").Formula = "=L*E"
Application.ScreenUpdating = True
' If k is null then no action required or else L1*E3
End If
Next
End Sub
i
在L=Cells(i,“L”)行单位化。Value
,因此它的值为0。电池阵列是基于1的。收到了,谢谢!我运行了它,我意识到它不起作用,可能是因为excel不识别L*E函数。我该怎么做?@Niva-不太确定您试图构建的公式是什么,但我猜它应该类似于单元格(i,“N”)。公式=“=L”&i&“*E”&i