First, I used sum, not product.
But you could modify the original suggestion to:
Option Explicit
Private Sub TextBox1_Change()
Call TBChange
End Sub
Private Sub TextBox2_Change()
Call TBChange
End Sub
Private Sub TextBox3_Change()
Call TBChange
End Sub
Private Sub TBChange()
Dim myValue As Double
myValue = 1
If IsNumeric(Me.TextBox1.Value) Then
myValue = myValue * CDbl(Me.TextBox1.Value)
End If
If IsNumeric(Me.TextBox2.Value) Then
myValue = myValue * CDbl(Me.TextBox2.Value)
End If
If IsNumeric(Me.TextBox3.Value) Then
myValue = myValue * CDbl(Me.TextBox3.Value)
End If
'formatted?
Me.TextBox4.Value = Format(myValue, "00.00")
End Sub
The majority of the code is to prevent an error -- when you try to multiply
something that's not a number.
You could choose to ignore the error (on error resume next) or try to avoid it
in code. The choice is your own (obviously).
Amber_D_Laws wrote:
>
> That's great Dave, but a little more complicated than I expected.
> If I were doing this in the worksheet it would be...
>
> A3*A4*A5
>
> but, this is the userform, and they are textboxes, so I was expecting
> something more along the lines of
>
> (txtUnitPrice.Value*txtTATMultiplier*txtSampleNum).Value =
> txtTotalPrice
>
> of course, I could be completly off base. I have to admit, I don't even
> follow the logic of your code. I can't tell where the multiplication is
> happening. Let me know. The txt's above are the names of the textboxes.
> Sorry if my earlier posts were unclear. I forget sometimes that you all
> are not in my head and might not know what I am talking about.
>
> Ha!
> Thanks again Dave,
> Amber 
>
> Dave Peterson Wrote:
> > Maybe something like:
> >
> > Option Explicit
> > Private Sub TextBox1_Change()
> > Call TBChange
> > End Sub
> > Private Sub TextBox2_Change()
> > Call TBChange
> > End Sub
> > Private Sub TextBox3_Change()
> > Call TBChange
> > End Sub
> > Private Sub TBChange()
> > Dim myValue As Double
> > myValue = 0
> > If IsNumeric(Me.TextBox1.Value) Then
> > myValue = myValue + CDbl(Me.TextBox1.Value)
> > End If
> > If IsNumeric(Me.TextBox2.Value) Then
> > myValue = myValue + CDbl(Me.TextBox2.Value)
> > End If
> > If IsNumeric(Me.TextBox3.Value) Then
> > myValue = myValue + CDbl(Me.TextBox3.Value)
> > End If
> >
> > 'formatted?
> > Me.TextBox4.Value = Format(myValue, "00.00")
> > End Sub
> >
> >
> > Amber_D_Laws wrote:
> > >
> > > Any one else think they can help?
> > >
> > > Amber 
> > >
> > > --
> > > Amber_D_Laws
> > >
> > ------------------------------------------------------------------------
> > > Amber_D_Laws's Profile:
> > http://www.excelforum.com/member.php...o&userid=30012
> > > View this thread:
> > http://www.excelforum.com/showthread...hreadid=513735
> >
> > --
> >
> > Dave Peterson
>
> --
> Amber_D_Laws
> ------------------------------------------------------------------------
> Amber_D_Laws's Profile: http://www.excelforum.com/member.php...o&userid=30012
> View this thread: http://www.excelforum.com/showthread...hreadid=513735
--
Dave Peterson
Bookmarks