#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 :)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Elseif code

Instead of using vba to sort out all the possibilities you might want to make
a table on a worksheet with all the possible configuations.
Then have your comboboxes with the list fill range set to columns in your
table

When you want to have the 2nd combobox filled with items that vary depending
on what the user selected in the 1st combobox, there is a good demo of how to
do this at : http://contextures.com/xlDataVal02.html

Hope this helps

"HFB" wrote:

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 :)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ELSEIF Loop to End Robbie Doo Excel Discussion (Misc queries) 0 January 13th 10 11:11 PM
Elseif? ibrokit Excel Worksheet Functions 5 November 25th 08 04:28 PM
if elseif flow23 Excel Discussion (Misc queries) 0 November 14th 05 02:09 PM
ElseIf tom1646 Excel Programming 4 October 19th 04 02:09 PM
If...Elseif...End If javab98 Excel Programming 2 July 19th 04 07:23 PM


All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"