小编SiG*_*Gm4的帖子

查找最多3个输入VBA

我试图找到最多3个输入.问题不在算法中,因为当我在python中制作相同的脚本时,它运行得很好.问题是它没有按预期工作.我将写一些场景,结果是什么:

8 5 12 - 最大值:12
5 8 12 - 最大值:12
12 5 8 - 最大值:8
12 8 5 - 最大值:8
5 12 8 - 最大值:8
8 12 5 - 最大值:8
100 22 33 - 最大值:33
22 3 100 - 最大:100
100 22 3 - 最大:22

似乎它适用于某种组合,但不适用于每一种组合.我还没有设法找到一个模式,我无法弄清楚出了什么问题.

我附上代码:

Sub Maxthree()
'Calculates the maximum of three numbers'
Dim x, y, z As Single
x = InputBox("Enter the first number!")
y = InputBox("Enter the second number!")
z = InputBox("Enter the third number!") …
Run Code Online (Sandbox Code Playgroud)

excel vba max

3
推荐指数
1
解决办法
6823
查看次数

标签 统计

excel ×1

max ×1

vba ×1