帮忙看下哪不对,显示case没有select case

[复制链接]
查看11 | 回复1 | 2010-6-29 09:51:58 | 显示全部楼层 |阅读模式
Private Sub Command1_Click()
'定义票价变量
Dim Text1 As Single
'定义月份变量
Dim Text2 As Integer
'定义张数变量
Dim Text3 As Integer
'定义计算结果变量
Dim Text4 As Single
'根据月份处理数据
total = Text4
Select Case Text2
Case Text2 = 7 To 9
If Text2 > 20 Then

total = Text1 * Text2 * (1 - 0.15)
Else
If Text2 > 10 Then

total = Text1 * Text2 * (1 - 0.05)
Else

total = Text1 * Text2
End If
Case Text2 = 1 To 5, 10, 11
If Text2 > 20 Then

total = Text1 * Text2 * (1 - 0.25)
Else
If Text2 > 10 Then

total = Text1 * text2b * (1 - 0.15)
Else

total = Text1 * Text2
End If
Case Text2 = 6 To 12
total = Text1 * Text3
Case Else
MsgBox "月份值不合理,请重新输入!"
Exit Sub '提前退出
End Select
End Sub

回复

使用道具 举报

千问 | 2010-6-29 09:51:58 | 显示全部楼层
Select Case Text2Case Text2 = 7 To 9If Text2 > 20 Then
total = Text1 * Text2 * (1 - 0.15)ElseIf Text2 > 10 Then
total = Text1 * Text2 * (1 - 0.05)Else
total = Text1 * Text2End If这一段少了一个End IF(下面那段case分支一样也少)一般来说,select case确实存在,但提示case没有select case之类的错误,是if或者for语句等没有对应的end if ,next
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行