Addition code for 110 TextBoxes
But what will fire the macro - 110 event macros?
--
Regards,
Tom Ogilvy
John Wilson wrote in message
...
Todd,
Another option..................
This would be easier if what you wanted to add were already
sequentially numbered.
If it's possible to rename the TextBoxes from let's say
TextBox1 to TB1, TB2, etc.
I'm sure this probably isn't feasable if you already have code linked
to the TextBoxes, but for future reference.....................
You could then use a loop to add them up:
Example:
Sub TestMe()
Dim x As Integer
Dim mysum As Integer
mysum = 0
On Error Resume Next
For x = 1 To 110
mysum = mysum + Val(UserForm1.Controls("TB" & x).Value)
Next x
On Error GoTo 0
MsgBox mysum
End Sub
John
"Todd Huttenstine" wrote in message
...
The below code adds up all the values of the specified TextBoxes. I
need
this code to run after any value in any of the specified textboxes
change
in
addition to another 88 TextBoxes that I have not listed. Instead of
having
to put this code in all 110 TextBoxes, is there an easier way to get
this
code to run?
TextBox9.Value TextBox14.Value + TextBox19.Value + TextBox24.Value +
TextBox29.Value + TextBox34.Value + _
TextBox39.Value + TextBox44.Value + TextBox49.Value + TextBox54.Value +
TextBox59.Value + TextBox64.Value + _
TextBox69.Value + TextBox74.Value + TextBox79.Value + TextBox84.Value +
TextBox89.Value + TextBox94.Value + _
TextBox99.Value + TextBox104.Value + TextBox109.Value + TextBox114
Thank you
Todd Huttenstine
|