Hi,
i'm slowly getting there after copying loads of examples and working through modify and create my own code to make a userform front end for a database, i'm almost done but looking back through the code some of the parts i have done myself look a little 'messy' but as they are specific to my needs trying to search for 'how to tidy this mess up' is fruitless. the following code takes input from comboboxes adn multiplies the three values together to create a 'score' which we will use elsewhere, i was wondering, seeing as the code is virtually idential could it be done with less code some how ?
Here is the current code:
Reg 11, 12, 13 are combobox's
Reg14 is just a textbox to display the result
it would look neater IMO without all the duplication, or am i just being pedantic and if its not broke dont try to fix it ?
i'm slowly getting there after copying loads of examples and working through modify and create my own code to make a userform front end for a database, i'm almost done but looking back through the code some of the parts i have done myself look a little 'messy' but as they are specific to my needs trying to search for 'how to tidy this mess up' is fruitless. the following code takes input from comboboxes adn multiplies the three values together to create a 'score' which we will use elsewhere, i was wondering, seeing as the code is virtually idential could it be done with less code some how ?
Here is the current code:
Code:
Private Sub Reg11_Change()
If Reg11.Value >= 0 Then
Reg14.Value = Reg11.Value * Reg12.Value * Reg13.Value
End If
End Sub
Private Sub reg12_Change()
If Reg12.Value >= 0 Then
Reg14.Value = Reg11.Value * Reg12.Value * Reg13.Value
End If
End Sub
Private Sub Reg13_Change()
If Reg13.Value >= 0 Then
Reg14.Value = Reg11.Value * Reg12.Value * Reg13.Value
End If
End Sub
Private Sub Reg14_Change()
Me.Reg14 = Reg14.Value
End Sub
Reg 11, 12, 13 are combobox's
Reg14 is just a textbox to display the result
it would look neater IMO without all the duplication, or am i just being pedantic and if its not broke dont try to fix it ?