Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculating recurring date in following month, calculating # days in that period | Excel Worksheet Functions | |||
CALCULATING WORKSHEETS (INCLUDING AGE CALCULATING SHEETS) FOR DOWNLOADING, GREAT FOR PENSIONS/LIFE INSURANCE CALCULATIONS! | Excel Programming | |||
Textboxes | Excel Programming | |||
textboxes | Excel Programming | |||
Calculating with textboxes.... | Excel Programming |