vba

图1.png

vba代码:
Sub payable()

Cells(4, 5) = Cells(4, 3) * Cells(4, 4) * 0.2
Cells(4, 6) = Cells(4, 3) * Cells(4, 4) * 0.1
Cells(4, 7) = Cells(4, 3) * Cells(4, 4) * 0.05
End Sub

为了使代码简洁,降低拼写错误概率,引入变量,将

代码更改为:
Sub payable()

x= Cells(4, 3) * Cells(4, 4)
Cells(4, 5) = x * 0.2
Cells(4, 6) = x * 0.1
Cells(4, 7) = x * 0.05

End Sub

你可能感兴趣的:(vba)