PDA

View Full Version : Solved: Sum condition



ulfal028
02-02-2006, 03:02 AM
I'm using a spin button on a userform to alter an existing value (Label11) through a textbox. What I would like is to set a condition for Label27 so it can have any value as long as it's above 0 (zero).

Example:
Label27 value is 270 = Label27 value is 270
Label27 value is -22 = Label27 value is 0

Private Sub SpinButton1_Change()
Me.TextBox1 = Format(Me.SpinButton1.Value)
Label27 = Label11 + CDbl(TextBox1.Value)
End Sub

Appreciate some help here...

Bob Phillips
02-02-2006, 03:07 AM
I'm using a spin button on a userform to alter an existing value (Label11) through a textbox. What I would like is to set a condition for Label27 so it can have any value as long as it's above 0 (zero).

Example:
Label27 value is 270 = Label27 value is 270
Label27 value is -22 = Label27 value is 0

Private Sub SpinButton1_Change()
Me.TextBox1 = Format(Me.SpinButton1.Value)
Label27 = Label11 + CDbl(TextBox1.Value)
End Sub

Appreciate some help here...



Label27.Caption = CStr(Application.MAX(0, Label11.Caption + CDbl(Textbox1.Text)))

ulfal028
02-02-2006, 04:05 AM
Works great. Thanks!