Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Fri, 10 Oct 2008 09:52:01 -0700,    group: microsoft.public.word.vba.general        back       


Averaging the values in Textboxes   
I have created a small form with 10 textbox objects from the "Control 
Toolbox" that will receive a value of 1 through 5 by the user.  In the 11th 
textbox I want to calculate the average of the 10 values.  Can someone please 
show me the code for getting this accomplished?

Thank you very much!
date: Fri, 10 Oct 2008 09:52:01 -0700   author:   theroundpen

Re: Averaging the values in Textboxes   
On Oct 10, 12:52 pm, theroundpen
 wrote:
> I have created a small form with 10 textbox objects from the "Control
> Toolbox" that will receive a value of 1 through 5 by the user.  In the 11th
> textbox I want to calculate the average of the 10 values.  Can someone please
> show me the code for getting this accomplished?
>
> Thank you very much!

You could use something like this which you would need to adapt for 10
text fields.:

Private Sub TextBox1_Change()
DoCalc
End Sub
Private Sub TextBox2_Change()
DoCalc
End Sub
Private Sub TextBox3_Change()
DoCalc
End Sub


Sub DoCalc()
Me.TextBox4.Value = (Val(Me.TextBox1.Value)  Val(Me.TextBox2.Value) 
Val(Me.TextBox3.Value)) / 3
End Sub
date: Fri, 10 Oct 2008 18:16:30 -0700 (PDT)   author:   Greg Maxey

Re: Averaging the values in Textboxes   
This was exactly what I needed - THANK YOU!!!! 

"Greg Maxey" wrote:

> On Oct 10, 12:52 pm, theroundpen
>  wrote:
> > I have created a small form with 10 textbox objects from the "Control
> > Toolbox" that will receive a value of 1 through 5 by the user.  In the 11th
> > textbox I want to calculate the average of the 10 values.  Can someone please
> > show me the code for getting this accomplished?
> >
> > Thank you very much!
> 
> You could use something like this which you would need to adapt for 10
> text fields.:
> 
> Private Sub TextBox1_Change()
> DoCalc
> End Sub
> Private Sub TextBox2_Change()
> DoCalc
> End Sub
> Private Sub TextBox3_Change()
> DoCalc
> End Sub
> 
> 
> Sub DoCalc()
> Me.TextBox4.Value = (Val(Me.TextBox1.Value) + Val(Me.TextBox2.Value) +
> Val(Me.TextBox3.Value)) / 3
> End Sub
>
date: Mon, 13 Oct 2008 11:11:02 -0700   author:   theroundpen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us