View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default If Then statement in a userform sub

Not sure how exactly you want it, but I think this is it:

Private Sub CommandButton1_Click()

If OptionALL Then
Cells(1, 2).Value = "ALL"
Call Analyze
Else
If OptionSelect Then
Cells(1, 2).Value = TextBox1.Text
Call Analyze2
JOIST.Hide
End If
End If

End Sub

Maybe you can leave
If OptionSelect Then
and the corresponding If out.

RBS


wrote in message
oups.com...
Hi all:

The following sub is for the "OK" button on the userform.


Private Sub CommandButton1_Click()
If OptionALL Then Cells(1, 2).Value = "ALL"
Call Analyze

If OptionSelect Then Cells(1, 2).Value = TextBox1.Text
Call Analyze2
JOIST.Hide
End Sub


The problem is when the first "IF" statement is not true it does not
skip "Call Analyze" which is a sub in the standard module.
how can i make it,when the first "if" statement is not true, to go to
the second "if" statement? Thanks for any help!