PDA

View Full Version : Solved: Elseif select case not working



tlchan
11-09-2010, 07:19 AM
Hi,

I try to compute the matrix table into user form where the user select the option with radio button. The result will be shown in the label caption with command button click event.

All can be achieved the desired result except the negative area showing no result. I'm still cannot figure where goes wrong with the code.

Can anybody assist ?

Thank you


:banghead:

austenr
11-09-2010, 07:30 AM
Well just a quick look I see you are not ending your CASE statements. Thats a problem.

Bob Phillips
11-09-2010, 07:59 AM
It is not meeting any conditions.

What settings should produce what result?

tlchan
11-09-2010, 08:02 AM
I just do not know how to end the CASE statement. Can adjust for me?

Bob Phillips
11-09-2010, 08:11 AM
I think I have figured it



Private Sub CommandButton1_Click()

With Lbl_MOA

Select Case Tb_economy.Text

Case "Positive"

Select Case True

Case Opt_PropPrime: .Caption = "MOA is 95%"

Case Opt_Propstable And Opt_landed:
.Caption = "MOA is 90%-(Landed)"

Case Opt_Propstable And opt_nonland:
If Opt_Keyarea Then

.Caption = "MOA is 90% (NON-LANDED Key-Area)"
Else

.Caption = "MOA is 85%(NON-LANDED Other Area)"
End If

Case Opt_propNeg: .Caption = "MOA is 85% (Negative Area)"
End Select

Case "Stable"

Select Case True

Case Opt_PropPrime: .Caption = "MOA is 90%"

Case Opt_Propstable And Opt_landed:
.Caption = "MOA is 90%-(Landed)"

Case Opt_Propstable And opt_nonland:
If Opt_Keyarea Then

.Caption = "MOA is 90% (NON-LANDED Key-Area)"
Else

.Caption = "MOA is 85%(NON-LANDED Other Area)"
End If

Case Opt_propNeg: .Caption = "MOA is 85% (Negative Area)"
End Select

Case "Negative"

Select Case True

Case Opt_PropPrime: .Caption = "MOA is 90%"

Case Opt_Propstable And Opt_landed:
.Caption = "MOA is 85%-(Landed)"

Case Opt_Propstable And opt_nonland:
If Opt_Keyarea Then

.Caption = "MOA is 85% (NON-LANDED Key-Area)"
Else

.Caption = "MOA is 85%(NON-LANDED Other Area)"
End If

Case Opt_propNeg: .Caption = "MOA is 80% (Negative Area)"
End Select

Case Else

MsgBox "Economy outlook Not selected!"
End Select
End With

End Sub

tlchan
11-09-2010, 10:34 AM
Amazing! It works like a charm.

Thanks Xld. :friends: