Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calculation does not appear in userform


Hi

I have several Textboxs in a userform
main Textbox shows the total of the values entered into textboxs

my problem is : the total does not appear in the main Textbox untill
fill in
all other Textboxs............somtimes i want to fill in only fe
textboxes, so
the total does not appear in the Textbox that shows the total......

here is the codes i used in the userform:

PHP code
-------------------
Sub MyCalc()
If IsNumeric(tot.Text) Then
If IsNumeric(txtConsu.Text) Then
If IsNumeric(txtMaint.Text) Then
If IsNumeric(txtClea.Text) Then
If IsNumeric(carmaint.Text) Then
If IsNumeric(TransM.Text) Then
If IsNumeric(machm.Text) Then

bal.Value = CDbl(tot.Value) - (CDbl(txtConsu.Value) _
+ CDbl(txtMaint.Value) + CDbl(txtClea.Value) _
+ CDbl(carmaint.Value) + CDbl(TransM.Value) _
+ CDbl(machm.Value))
End If
End If
End If
End If
End If
End If
End If
END Sub

Private Sub tot_Change()
MyCalc
End Sub
Private Sub txtConsu_Change()
MyCalc
End Sub
Private Sub txtMaint_Change()
MyCalc
End Sub

Private Sub txtClea_Change()
MyCalc
End Sub

Private Sub carmaint_Change()
MyCalc
End Sub

Private Sub TransM_Change()
MyCalc
End Sub

Private Sub machm_Change()
MyCalc
End Su
-------------------


I highly appreciate any help ;) ;)
yours


--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=27002

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Calculation does not appear in userform

Lots of ways you could handle this, but here's an easy one.

Private Sub MyCalc()
Dim dTotal As Double
On Error Resume Next
dTotal = dTotal + CDbl(TextBox1.Text)
dTotal = dTotal + CDbl(TextBox2.Text)
dTotal = dTotal + CDbl(TextBox3.Text)
'change the names of the boxes above and add the rest here
On Error GoTo 0
Label1.Caption = dTotal
End Sub

Robin Hammond
www.enhanceddatasystems.com

"helmekki" wrote in message
...

Hi

I have several Textboxs in a userform
main Textbox shows the total of the values entered into textboxs

my problem is : the total does not appear in the main Textbox untill i
fill in
all other Textboxs............somtimes i want to fill in only few
textboxes, so
the total does not appear in the Textbox that shows the total......

here is the codes i used in the userform:

Formula:
--------------------
Sub MyCalc()
If IsNumeric(tot.Text) Then
If IsNumeric(txtConsu.Text) Then
If IsNumeric(txtMaint.Text) Then
If IsNumeric(txtClea.Text) Then
If IsNumeric(carmaint.Text) Then
If IsNumeric(TransM.Text) Then
If IsNumeric(machm.Text) Then

bal.Value = CDbl(tot.Value) - (CDbl(txtConsu.Value) _
+ CDbl(txtMaint.Value) + CDbl(txtClea.Value) _
+ CDbl(carmaint.Value) + CDbl(TransM.Value) _
+ CDbl(machm.Value))
End If
End If
End If
End If
End If
End If
End If
END Sub

Private Sub tot_Change()
MyCalc
End Sub
Private Sub txtConsu_Change()
MyCalc
End Sub
Private Sub txtMaint_Change()
MyCalc
End Sub

Private Sub txtClea_Change()
MyCalc
End Sub

Private Sub carmaint_Change()
MyCalc
End Sub

Private Sub TransM_Change()
MyCalc
End Sub

Private Sub machm_Change()
MyCalc
End Sub
--------------------


I highly appreciate any help ;) ;)
yours
h


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=270022



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
Auto calculation on a userform Greg B Excel Discussion (Misc queries) 0 June 13th 05 01:51 AM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM
Date Calculation in UserForm TextBox John Pierce Excel Programming 2 February 28th 04 12:11 AM
range.calculation with UDF not working when calculation is set to automatic Brian Murphy Excel Programming 5 October 14th 03 07:02 PM


All times are GMT +1. The time now is 12:48 PM.

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"