10-27-2021
05:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-27-2021
05:49 AM
This would be a good one to use nested If Statements:
'Nesting If Statements Example:
If s_o_width <= 2500 'If Level 1
If s_o_height <= 1500 'If Level 2-A
headbox_depth = 125
headbox_length = 150
Else If s_o_height <= 3000 'Else If Level 2-A
headbox_depth = 150
headbox_length = 150
Else If s_o_height <= 6000 'Else If Level 2-A
headbox_depth = 180
headbox_length = 180
Else If s_o_height <= 9000 'Else If Level 2-A
headbox_depth = 210
headbox_length = 210
Else If s_o_height <= 12000 'Else If Level 2-A
headbox_depth = 230
headbox_length = 230
Else 'Else Level 2-A
MessageBox.Show("s_o_height is Greater than 12000")
End If 'End Level 2-A
Else If s_o_width < 5000 'Else If Level 1
If s_o_height <= 1500 'If Level 2-B
headbox_depth = 150
headbox_length = 150
Else If s_o_height <= 3000 'Else If Level 2-B
headbox_depth = 180
headbox_length = 180
Else If s_o_height <= 6000 'Else If Level 2-B
headbox_depth = 210
headbox_length = 210
Else If s_o_height <= 9000 'Else If Level 2-B
headbox_depth = 230
headbox_length = 230
Else If s_o_height <= 12000 'Else If Level 2-B
headbox_depth = 250
headbox_length = 250
Else 'Else Level 2-B
MessageBox.Show("s_o_height is Greater than 12000")
End If 'End Level 2-B
Else 'Else Level 1
MessageBox.Show("s_o_width is Greater than 5000")
End If 'End Level 1
If level 1 handles the 2 width options and then there is a level 2 if statement in each to handle the 5 height options.
Let me know if you have any questions, or if this is not working as intended