Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default calculating textboxes

I have four textboxes. 3 of them are multiplied by each other to get the
answer in the fourth box. Sometimes there is not information for the first
three boxes so the fourth textbox must be inputted manually. I need to able
to automatically calculate when there is information and manually input when
there is none. I need some coding to be able to this. I also need to
disable the total box when calculating manually but enable it when entering
manually. Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default calculating textboxes

I don't know if this is the most efficient way to do this, but it works. Try
the following code for the Exit Event for each of the 3 text boxes,

Private Sub txt1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim v1 As Double
Dim v2 As Double
Dim v3 As Double

If txt1.Value = "" And txt2.Value = "" And txt3.Value = "" Then
txt4.Enabled = True
Else:
txt4.Enabled = False
If txt1.Value = "" Then
v1 = 1
Else:
v1 = txt1.Value
End If
If txt2.Value = "" Then
v2 = 1
Else:
v2 = txt2.Value
End If
If txt3.Value = "" Then
v3 = 1
Else:
v3 = txt3.Value
End If
txt4.Value = v1 * v2 * v3
End If

End Sub

"enyaw" wrote:

I have four textboxes. 3 of them are multiplied by each other to get the
answer in the fourth box. Sometimes there is not information for the first
three boxes so the fourth textbox must be inputted manually. I need to able
to automatically calculate when there is information and manually input when
there is none. I need some coding to be able to this. I also need to
disable the total box when calculating manually but enable it when entering
manually. Can anyone help?

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
Calculating recurring date in following month, calculating # days in that period Walterius Excel Worksheet Functions 6 June 4th 05 11:21 PM
CALCULATING WORKSHEETS (INCLUDING AGE CALCULATING SHEETS) FOR DOWNLOADING, GREAT FOR PENSIONS/LIFE INSURANCE CALCULATIONS! RICHARD Excel Programming 0 March 15th 05 01:41 PM
Textboxes Marcotte A Excel Programming 2 July 7th 04 12:55 AM
textboxes libby Excel Programming 5 April 13th 04 06:32 PM
Calculating with textboxes.... Mark Rosenkrantz Excel Programming 4 November 23rd 03 12:42 PM


All times are GMT +1. The time now is 10:18 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"