Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default sum function in a userfrom

Hello everybody, I new at this and I'm trying to make a userfrom that well
sum several txtboxes with the total at the bottom of the form, the
information from the txtboxes, is use to update a worksheet, kind of like
forcastsales for one day's work from 11AM -11PM how can I do it before
updating the worksheet getting the total of the day.
eny help well be in advance apreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default sum function in a userfrom

Here is some sample code (with a bit of data validation included) that could
be modified - this code would go in your Userform Code pane. I used 4
textboxes called T1, T2, T3 and TSUM - TSUM could (should) have Enabled =
False. I put the result in cell B3 but you can modify that to whatever you
need it to be, and of course you could store the individual textbox values in
any other cells as you wish.

Public T1Val As String
Public T2Val As String
Public T3Val As String

Private Sub T1_Change()

If Not (IsNumeric(T1) Or IsNull(T1) Or (T1 = "")) Then
Beep
T1 = T1Val
Else
T1Val = T1
TSUM.Text = Val(T1) + Val(T2) + Val(T3)
Range("B3") = Val(TSUM)
End If

End Sub

Private Sub T2_Change()

If Not (IsNumeric(T2) Or IsNull(T2) Or (T2 = "")) Then
Beep
T2 = T2Val
Else
T2Val = T2
TSUM.Text = Val(T1) + Val(T2) + Val(T3)
Range("B3") = Val(TSUM)
End If

End Sub

Private Sub T3_Change()

If Not (IsNumeric(T3) Or IsNull(T3) Or (T3 = "")) Then
Beep
T3 = T3Val
Else
T3Val = T3
TSUM.Text = Val(T1) + Val(T2) + Val(T3)
Range("B3") = Val(TSUM)
End If

End Sub



"niteman" wrote:

Hello everybody, I new at this and I'm trying to make a userfrom that well
sum several txtboxes with the total at the bottom of the form, the
information from the txtboxes, is use to update a worksheet, kind of like
forcastsales for one day's work from 11AM -11PM how can I do it before
updating the worksheet getting the total of the day.
eny help well be in advance apreciated

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default sum function in a userfrom

Have a command button that does it

e.g.

TextBox4.Text = Format(CDbl(Textbox1.Text) + _
CDbl(Textbox2.Text) + _
CDbl(Textbox3.Text),"#,##0.00")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"niteman" wrote in message
...
Hello everybody, I new at this and I'm trying to make a userfrom that well
sum several txtboxes with the total at the bottom of the form, the
information from the txtboxes, is use to update a worksheet, kind of like
forcastsales for one day's work from 11AM -11PM how can I do it before
updating the worksheet getting the total of the day.
eny help well be in advance apreciated



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
Userfrom problem... the dude Excel Discussion (Misc queries) 3 May 31st 06 09:33 PM
How do you use DTpicker in a Userfrom TDR Excel Discussion (Misc queries) 2 August 9th 05 01:43 PM
can you use the dtpicker in an userfrom TerryR Excel Worksheet Functions 1 August 1st 05 03:20 PM
Userfrom textboxes Jo[_6_] Excel Programming 2 October 21st 03 06:56 PM
Userfrom textboxes Jo[_6_] Excel Programming 1 October 21st 03 05:47 PM


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

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

About Us

"It's about Microsoft Excel"