View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Matthew Pfluger Matthew Pfluger is offline
external usenet poster
 
Posts: 130
Default add total from 6 textboxes and put in label

Hello,

Try this:

Sub Example()

' Create variables
Dim dRunningTotal As Double
Dim ctrl As MSForms.ctrlontrol

' Loop through controls looking for text boxes
For Each ctrl In Me.ctrlontrols
If TypeOf ctrl Is MSForms.TextBox Then
' Remove first letter from text box value
dRunningTotal = dRunningTotal + Right(ctrl.Text, Len(ctrl.Text)
- 1)
End If
Next ctrl

' Copy total to label
Me.label24.Value = dRunningTotal

End Sub

HTH,
Matthew Pfluger

"pswanie" wrote:

i got 6 textboxes where users enter amounts. i need the total from those to
display in label24 userform1

would it be posible to default the amount enterd in a text box with the
prefix "R" and "." to seperate sents? we use amounts like R1125.80