I'm using the following code (edited) where I evaluate an options value then perform some code then use the same procedure to evaluate the options value then perform another piece of code etc etc.
Although this works fine, it's very clunky and I'm sure it's not a good example of proper coding.
How can I make an option's value, with its if statement global? Or rather how do I make it into user friendly code?
Regards
Wayne
Code:
Private Sub CmdDraw_Click()
InsertSoleBoards
InsertJacks
InsertJackNuts
End Sub
'---------------------------
Private Sub InsertSoleBoards()
'Snip..
If Opt12ReturnBay = True Then
LHbay = -1270
RHbay = 1270
ElseIf Opt18ReturnBay = True Then
LHbay = -1829
RHbay = 1829
Else
LHbay = -2438
RHbay = 2438
End If
'code that uses these values
End Sub
'----------------------------------------
Private Sub InsertJacks()
'Snip..
If Opt12ReturnBay = True Then
LHbay = -1270
RHbay = 1270
ElseIf Opt18ReturnBay = True Then
LHbay = -1829
RHbay = 1829
Else
LHbay = -2438
RHbay = 2438
End If
'code that uses these values
End Sub
'------------------------------
Private Sub InsertJackNuts()
'Snip..
If Opt12ReturnBay = True Then
LHbay = -1270
RHbay = 1270
ElseIf Opt18ReturnBay = True Then
LHbay = -1829
RHbay = 1829
Else
LHbay = -2438
RHbay = 2438
End If
'code that uses these values
End Sub