Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
funkymonkUK
 
Posts: n/a
Default Userform with 5 textbox and 1 needs to refresh to have total


hey

I have 5 text boxes which 1 of them has to be a running total of what
has been entered in. what I tried linking the 5 textboxs to a cell and
then for the one that i want to have the total in i have made its value
= cell however this does not seem to update. any ideas? i dont want the
user to input this textbox so i disabled it will that make a
difference??

Any help will be appreicated


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=345880

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I put 5 textboxes on a user form.

I was careful to name the first four nicely:
TextBox1 through TextBox4
Then I could use that in the code:

Option Explicit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Call doSumTB5
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Call doSumTB5
End Sub
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Call doSumTB5
End Sub
Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Call doSumTB5
End Sub
Sub doSumTB5()
Dim iCtr As Long
Dim myTotal As Double

myTotal = 0
For iCtr = 1 To 4
With Me.Controls("textbox" & iCtr)
If IsNumeric(.Value) Then
myTotal = myTotal + CDbl(.Value)
End If
End With
Next iCtr

Me.TextBox5.Value = Format(myTotal, "#,##0.000")

End Sub
Private Sub UserForm_Initialize()
Me.TextBox5.Locked = True
End Sub

=======
Have you thought of making the 5th textbox a label (or at least locking the
textbox)--some kind of protection from the user???


funkymonkUK wrote:

hey

I have 5 text boxes which 1 of them has to be a running total of what
has been entered in. what I tried linking the 5 textboxs to a cell and
then for the one that i want to have the total in i have made its value
= cell however this does not seem to update. any ideas? i dont want the
user to input this textbox so i disabled it will that make a
difference??

Any help will be appreicated

--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=345880


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Data From Textbox SEA Excel Worksheet Functions 6 February 5th 09 08:21 PM
manipulating textbox in chart Peter Hafner Charts and Charting in Excel 0 January 31st 05 10:55 AM
userform textbox Phil Excel Worksheet Functions 5 January 16th 05 06:59 PM
Help needed with textbox formatting in Excel 2000 JIMBROOKS Excel Discussion (Misc queries) 1 January 1st 05 03:33 PM


All times are GMT +1. The time now is 09:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"