Thread: Elseif code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
HFB HFB is offline
external usenet poster
 
Posts: 17
Default Elseif code

I have:
3 combo boxes for specifying jamb profile
1 text box for specifying alternative jamb profile
1 text box for entering the width of the stud
1 text box for displaying the width of the jamb

I need the Jamb Width text box to display a value based on what is in the
jamb profile boxes and the stud box. Only one of the boxes will display a
jamb profile (e.g. if one combo box is displaying "18mm Flat" then all the
others will be "")

Basically

If Jamb Profile = "18mm Flat", "Flat", "Arch" or "Architrave", then
Jamb Width = Stud Width +22

Else Jamb Width = Stud Width + 45

I've go the following code:
'DEFINE VARIABLES
Dim Jamb As Integer
Dim Stud As Integer
Dim comFPine As String
Dim ComCPine As String
Dim ComMUF As String
Dim txtProfileSpec As String

'INPUT

Stud = Val(txtStud1)

'PROCESS
'If Profile is Architrave, then Jamb = Stud + 22
'If Profile is Grooved, then Jamb = Stud + 45

If comFPine = "18mm Flat" Then
Jamb = Stud + 22
ElseIf ComCPine = "18mm Flat" Then
Jamb = Stud + 22
ElseIf ComMUF = "18mm Flat" Then
Jamb = Stud + 22
ElseIf txtProfileSpec = "Flat" Then
Jamb = Stud + 22
ElseIf txtProfileSpec = "Architrave" Then
Jamb = Stud + 22
ElseIf txtProfileSpec = "Arch" Then
Jamb = Stud + 22

Else: Jamb = Stud + 45
End If


'OUTPUT
txtJamb1 = Str(Jamb)

At the moment, all that does is the "Stud Width + 45" Part :)