Calculation error

ellyna

Banned - Rules violations
Joined
Nov 29, 2020
Messages
89
Office Version
  1. 2013
Platform
  1. Windows
Hi, when i submit the user form into excel sheet, the column on "Production Output and Total Rejection" do not show the value


1)"Production Output and Total Rejection" do not show the value .
1608609722286.png


2)The output that on multipage summary is below , but it does not calculate the total percentage . As i just do the first one and the result do not showed calculate of percentage.
VBA Code:
Private Sub TextBox3_Change()
      TextBox4.Value = IIf(Val(txtTextBox5) > 0, Val(TextBox5.Value) / Val(TextBox3.Value), "0.00%")
End Sub


Private Sub TextBox2_Change()
    TextBox6.Value = IIf(Val(txtTextBox2) > 0, Val(TextBox5.Value) / Val(TextBox2.Value), "0.00%")
End Sub

Private Sub TextBox5_Change()
    TextBox8.Value = IIf(Val(txtTextBox5) > 0, Val(TextBox7.Value) / Val(TextBox5.Value), "0.00%")
    
End Sub
1608615762037.png
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Should your code for TextBox for .4, .6 and .8 read If and not IIf?
Mel
 
Upvote 0
Try also removing “txt” from those 3 lines but keep the “If” not IIf.
Mel
 
Upvote 0
I think the line(s) should also read: If(Value.TextBox2) .....

Mel
 
Upvote 0
I modify your code and it worked but you shoud first input textbox 7 , 5, 3, 2 respectively. because they relationships.
VBA Code:
Private Sub TextBox3_Change()
      TextBox4.Value = IIf(Val(txtTextBox5) > 0, "0.00%", Val(TextBox5.Value) / Val(TextBox3.Value))
      TextBox4 = Format(TextBox4, "0.00%")
End Sub

Private Sub TextBox2_Change()
    TextBox6.Value = IIf(Val(txtTextBox2) > 0, "0.00%", Val(TextBox5.Value) / Val(TextBox2.Value))
    TextBox6 = Format(TextBox6, "#0.00%")
End Sub

Private Sub TextBox4_Change()
End Sub

Private Sub TextBox5_Change()
    TextBox8.Value = IIf(Val(txtTextBox5) > 0, "0.00%", Val(TextBox7.Value) / Val(TextBox5.Value))
    TextBox8 = Format(TextBox8, "#0.00%")
End Sub
 
Upvote 0
I modify your code and it worked but you shoud first input textbox 7 , 5, 3, 2 respectively. because they relationships.
VBA Code:
Private Sub TextBox3_Change()
      TextBox4.Value = IIf(Val(txtTextBox5) > 0, "0.00%", Val(TextBox5.Value) / Val(TextBox3.Value))
      TextBox4 = Format(TextBox4, "0.00%")
End Sub

Private Sub TextBox2_Change()
    TextBox6.Value = IIf(Val(txtTextBox2) > 0, "0.00%", Val(TextBox5.Value) / Val(TextBox2.Value))
    TextBox6 = Format(TextBox6, "#0.00%")
End Sub

Private Sub TextBox4_Change()
End Sub

Private Sub TextBox5_Change()
    TextBox8.Value = IIf(Val(txtTextBox5) > 0, "0.00%", Val(TextBox7.Value) / Val(TextBox5.Value))
    TextBox8 = Format(TextBox8, "#0.00%")
End Sub
I tried this code and it's work too. Can i use this code ? Please Advice

VBA Code:
Private Sub TextBox5_Change()
If TextBox3 <> "" And TextBox3 <> 0 Then
On Error Resume Next
    TextBox4.Value = Format((TextBox5.Value) / (TextBox3.Value), "0.00%")
    TextBox6.Value = Format((TextBox5.Value) / (TextBox2.Value), "0.00%")
End If
End Sub

Private Sub TextBox7_Change()
On Error Resume Next
    TextBox8.Value = Format((TextBox7.Value) / (TextBox5.Value), "0.00%")
End Sub

Private Sub TextBox13_Change()
If TextBox11 <> "" And TextBox11 <> 0 Then
On Error Resume Next
    TextBox12.Value = Format((TextBox13.Value) / (TextBox11.Value), "0.00%")
    TextBox14.Value = Format((TextBox13.Value) / (TextBox10.Value), "0.00%")
End If
End Sub

Private Sub TextBox15_Change()
On Error Resume Next
    TextBox16.Value = Format((TextBox15.Value) / (TextBox13.Value), "0.00%")
End Sub
 
Upvote 0
I think the line(s) should also read: If(Value.TextBox2) .....

Mel
I 'm using this code and it's work. Can i use this code ? Advice Please

VBA Code:
Private Sub TextBox5_Change()
If TextBox3 <> "" And TextBox3 <> 0 Then
On Error Resume Next
    TextBox4.Value = Format((TextBox5.Value) / (TextBox3.Value), "0.00%")
    TextBox6.Value = Format((TextBox5.Value) / (TextBox2.Value), "0.00%")
End If
End Sub

Private Sub TextBox7_Change()
On Error Resume Next
    TextBox8.Value = Format((TextBox7.Value) / (TextBox5.Value), "0.00%")
End Sub

Private Sub TextBox13_Change()
If TextBox11 <> "" And TextBox11 <> 0 Then
On Error Resume Next
    TextBox12.Value = Format((TextBox13.Value) / (TextBox11.Value), "0.00%")
    TextBox14.Value = Format((TextBox13.Value) / (TextBox10.Value), "0.00%")
End If
End Sub

Private Sub TextBox15_Change()
On Error Resume Next
    TextBox16.Value = Format((TextBox15.Value) / (TextBox13.Value), "0.00%")
End Sub
 
Upvote 0
Try this:
VBA Code:
Private Sub TextBox5_Change()
If TextBox3 <> "" And TextBox3 <> 0 Then
On Error Resume Next
    TextBox4.Value = Format((TextBox5.Value) / (TextBox3.Value), "0.00%")
    TextBox6.Value = Format((TextBox5.Value) / (TextBox2.Value), "0.00%")
End If
End Sub

Private Sub TextBox7_Change()
If TextBox5 <> "" And TextBox5 <> 0 Then
On Error Resume Next
    TextBox8.Value = Format((TextBox7.Value) / (TextBox5.Value), "0.00%")
End If
End Sub

Private Sub TextBox13_Change()
If TextBox11 <> "" And TextBox11 <> 0 Then
On Error Resume Next
    TextBox12.Value = Format((TextBox13.Value) / (TextBox11.Value), "0.00%")
    TextBox14.Value = Format((TextBox13.Value) / (TextBox10.Value), "0.00%")
End If
End Sub

Private Sub TextBox15_Change()
If TextBox13 <> "" And TextBox13 <> 0 Then
On Error Resume Next
    TextBox16.Value = Format((TextBox15.Value) / (TextBox13.Value), "0.00%")
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,209
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top