首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VBA >

帮忙看看vba程序哪儿有有关问题

2012-03-19 
帮忙看看vba程序哪儿有问题我没学过vba,是帮一个文科同学问的。代码如下:Sub taxip()Dim sngs As SingleDim

帮忙看看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查看结果

热点排行