View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default A beginners Elseif question

You don't need an elseif . Look at the two examples below

Private Sub OptionSprinL_Click()
If OptionSpring = False Then
'code if required
Else
Range("B27").Value = 0
End If
Range("B27").Formula = "=L175-K195"
Range("J199").Value = "SPRING"
Range("J203").Value = "LIFT"
End Sub

Private Sub OptionSprinL_Click()
If OptionSpring = True Then
Range("B27").Value = 0
End If
Range("B27").Formula = "=L175-K195"
Range("J199").Value = "SPRING"
Range("J203").Value = "LIFT"
End Sub


"Cerberus" wrote:

I have a user form I created and it has a few option buttons on it to specify
what type of suspension the customer wants. I have it set up so there are
two options for spring and two main options for air. The problem I am having
is if you select spring first and then decide you want air, the information
you enter form there on will effect spring and not air. I put in an Elseif
statement on one of the spring options but I am not sure if I need to put one
on the other also or if I simply did not write it correctly. Please take a
look at what I did and guide me in the right direction

Private Sub OptionSpring_Click()
Range("B27").Formula = "=L175"
Range("J199").Value = "SPRING"
Range("J203").Value = "NO LIFT"
End Sub

Private Sub OptionSprinL_Click()
If OptionSpring = False Then
ElseIf OptionSprinL = False Then
Range("B27").Value = 0
End If
Range("B27").Formula = "=L175-K195"
Range("J199").Value = "SPRING"
Range("J203").Value = "LIFT"
End Sub