1
2つの列にif else文を掛けるコードを設計しましたが、error 1004
をL = Cells(i, "L").Value
に取得しています。なぜこれが起こっているのかを明確にする必要があります。 これはコードです!実行時エラー1004列での乗算のループ
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
ありがとうございました!私はそれを実行し、ExcelがL * E関数を認識しないためにおそらく動作しないことに気付きました。それについてどうすればいいですか? – Niva
@Niva - あなたが構築しようとしている式が何であるか正確にはわかりませんが、私はそれが 'Cells(i、" N ")のようなものでなければならないと推測しています。 "&i' – Comintern