View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Change event for several Textboxes on UserForm

Simplest way is to have a simple sub to add them

Private Function SumValues()
Dim i As Long

With Me

.txtSum1.Text = Val(.TextBox1.Text) + Val(.TextBox2.Text)

.txtSum2.Text = Val(.TextBox1.Text) - Val(.TextBox12.Text) +
Val(.TextBox19.Text)

.txtSum3.Text = Val(.TextBox1.Text) * Val(.TextBox2.Text)
End With
End Function

Obviously you would need to change it to the correct sum calulations.

Then call it from each of the 35 textboxes like so


Private Sub TextBox1_AfterUpdate()
Call SumValues
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"RyanH" wrote in message
...
I have a Userform with about 35 Textboxes. I have 3 other Textboxes that
show calculation results from those 35 textboxes. I want those 3
textboxes
to refresh there results whenever any of the 35 textboxes are changed.
Instead of putting a Change Event in every single textbox is there a
shorter,
quicker way of doing this?