Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在excelvba中获取求和值_Excel_Vba - Fatal编程技术网

如何在excelvba中获取求和值

如何在excelvba中获取求和值,excel,vba,Excel,Vba,我是Excel VBA新手。有人能帮我吗 如果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,

我是Excel VBA新手。有人能帮我吗

如果
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
Sub-summation()
如果单元格(5,3)“,则
如果单元格(5,4)“,则
细胞(5,5)=细胞(5,3)+细胞(5,4)-细胞(5,2)
单元(5,2)=单元(5,2)-单元(5,5)
如果结束
如果结束
端接头

a您是否尝试过在单元格E5中输入=(C5+D5)-B5?能否同时提供一些格式/数据示例?