Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Excel VBA 的新手。有人可以帮我解决这个问题:
如果C5orD5不为空,则从单元格值中减去它们B5并获得单元格中的总和E5,
C5
D5
B5
E5
EX: E5= (C5+D5)-B5
同时 的值E5应该从值中减少B5
EX: B5=B5-E5
好吧,如果仅根据您的描述,它看起来像这样:
Sub summation() If Cells(5, 3) <> "" Then If Cells(5, 4) <> "" Then Cells(5, 5) = Cells(5, 3) + Cells(5, 4) - Cells(5, 2) Cells(5, 2) = Cells(5, 2) - Cells(5, 5) End If End If End Sub