作者:云彩熨衣裳 | 来源:互联网 | 2023-05-18 11:52
IamwritingVBAcodetoaddtwonumbers:我正在编写VBA代码来添加两个数字:OptionExplicitDimxAsInteger,yA
I am writing VBA code to add two numbers:
我正在编写VBA代码来添加两个数字:
Option Explicit
Dim x As Integer, y As Integer
Function addtwo(x, y)
addtwo = x + y
End Function
This is not a good function since I have to manually input the values x and y to get for the result. How can I modify the codes so it can work with any two numbers, no matter integers or numbers with decimals?
这不是一个好的功能,因为我必须手动输入值x和y来获得结果。如何修改代码,以便它可以使用任意两个数字,无论是整数还是带小数的数字?
2 个解决方案