前面有Dim imput as integer
Private Sub Command1_Click()
If imput > 3000 Then Text2.Text = Str(6.8)
ElseIf imput > 2000 And imput <= 3000 Then Text2.Text = Str(7)
ElseIf imput > 1000 And imput <= 2000 Then Text2.Text = Str(8)
ElseIf imput > 500 And imput <= 1000 Then Text2.Text = Str(9)
Else: Text2.Text = "无折扣."
End If
End Sub
这里怎么总是报错:“编译错误:Else 没有 If” ,为什么会这样?我把上面的ElseIf 改为 Else If 也不行!??
Private Sub Command1_Click()
If imput > 3000 Then Text2.Text = Str(6.8)
ElseIf imput > 2000 And imput <= 3000 Then Text2.Text = Str(7)
ElseIf imput > 1000 And imput <= 2000 Then Text2.Text = Str(8)
ElseIf imput > 500 And imput <= 1000 Then Text2.Text = Str(9)
Else: Text2.Text = "无折扣."
End If
End Sub
这里怎么总是报错:“编译错误:Else 没有 If” ,为什么会这样?我把上面的ElseIf 改为 Else If 也不行!??
这句错了,要分行
Else
Text2.Text = "无折扣."
If imput > 3000 Then
Text2.Text = Str(6.8)
ElseIf imput > 2000 And imput <= 3000 Then
Text2.Text = Str(7)
ElseIf imput > 1000 And imput <= 2000 Then
Text2.Text = Str(8)
ElseIf imput > 500 And imput <= 1000 Then
Text2.Text = Str(9)
Else: Text2.Text = "无折扣."
End If
End Sub
If imput > 3000 Then
Text2.Text = Str(6.8)
不要用这么多ELSEIF