VBA在EXCEL中调用excel的数据 编译错误:方法和数据成员未找到
求大神指教PrivateSubCommandButton1_Click()DimaAsDouble,bAsDouble,cAsDouble,boxAsString'定义变...
求大神指教
Private Sub CommandButton1_Click()
Dim a As Double, b As Double, c As Double, box As String '定义变量类型
a = Val(TextBox1.Value) '食物总支出金额
b = Val(TextBox2.Value) '所有总支出金额
c = a / b '恩格尔系数
Select Case c
Case 0.6 To 1
UserForm6.Hide
UserForm7.Label2.Caption = c
UserForm7.Show
Case 0.5 To 0.6
UserForm6.Hide
UserForm8.Label2.Caption = c
UserForm8.Show
Case 0.4 To 0.5
UserForm6.Hide
UserForm9.Label2.Caption = c
UserForm9.Show
Case 0.3 To 0.4
UserForm6.Hide
UserForm10.Label2.Caption = c
UserForm10.Show
Case 0 To 0.3
UserForm6.Hide
UserForm11.Label2.Caption = c
UserForm11.Show
Case Else
box = MsgBox("输入错误,请重新输入!", vbCritical, "错误")
End Select
End Sub 展开
Private Sub CommandButton1_Click()
Dim a As Double, b As Double, c As Double, box As String '定义变量类型
a = Val(TextBox1.Value) '食物总支出金额
b = Val(TextBox2.Value) '所有总支出金额
c = a / b '恩格尔系数
Select Case c
Case 0.6 To 1
UserForm6.Hide
UserForm7.Label2.Caption = c
UserForm7.Show
Case 0.5 To 0.6
UserForm6.Hide
UserForm8.Label2.Caption = c
UserForm8.Show
Case 0.4 To 0.5
UserForm6.Hide
UserForm9.Label2.Caption = c
UserForm9.Show
Case 0.3 To 0.4
UserForm6.Hide
UserForm10.Label2.Caption = c
UserForm10.Show
Case 0 To 0.3
UserForm6.Hide
UserForm11.Label2.Caption = c
UserForm11.Show
Case Else
box = MsgBox("输入错误,请重新输入!", vbCritical, "错误")
End Select
End Sub 展开
若以下回答无法解决问题,邀请你更新回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询