VBA noob在这里,
所以我有3列(A,B和C)
A = Received Goods
B = Sent Goods for Shop 1
C = Sent Goods for Shop 2我想要B+C =中的值单元格,否则会给我一条错误消息。
这是我的代码:
If Range("A1").End(xlDown).Value <> Range("B1").End(xlDown).Value & Range("C1").End(xlDown).Value Then
MsgBox "Error, wrong number of sent goods"
End If
End Sub发布于 2019-03-27 12:07:20
就是这样:
Option Explicit
Sub Warning()
Dim A As Long, B As Long, C As Long 'in case you have floating numbers use Single or Double instead
With ThisWorkbook.Sheets("NameOfYourSheet")
A = .Cells(.Rows.Count, "A").End(xlUp)
B = .Cells(.Rows.Count, "B").End(xlUp)
C = .Cells(.Rows.Count, "C").End(xlUp)
End With
If B + C <> A Then
MsgBox "Error, wrong number of sent goods"
End If
End Sub我假设你正在尝试每一列的最后一行。
https://stackoverflow.com/questions/55376736
复制相似问题