帮忙看看vba程序哪儿有问题
我没学过vba,是帮一个文科同学问的。代码如下:
Sub taxip()
Dim sngs As Single
Dim sngp As Single
sngs = InputBox("请输入里程数:", "出租车里程")
Select Case sngs
Case Is <= 3
sngp = 10
Case Is <= 15
sngp = 10 + (sngs - 3) * 2
Case Else
sngp = 10 + (15 - 3) * 2 + (sngs - 15) * 3
End Select
Debug.Print "出租车费用为: ": sngp
End SubOption Compare Database
Private Sub com1_Click()
Title. Caption = LTrim(Text) + "二级等级考试测试"
End Sub
请大家帮帮忙!
[解决办法]
Sub Button1_Click()
Dim sngs As Single
Dim sngp As Single
sngs = InputBox("请输入里程数:", "出租车里程")
Select Case sngs
Case Is <= 3
sngp = 10
Case Is <= 15
sngp = 10 + (sngs - 3) * 2
Case Else
sngp = 10 + (15 - 3) * 2 + (sngs - 15) * 3
End Select
Debug.Print "出租车费用为: " & sngp
End Sub
Ctrl+G查看结果