VBA calculation error

paroduso

Board Regular
Joined
Sep 11, 2013
Messages
103
Office Version
  1. 2019
Platform
  1. Windows
good night...i have a problem in my userform ... i have 5 textboxes...in texbox4 i have the result of dividing the values of textbox1 and textbox2 ... in textbox5 i have the result of multiplying the value of textbox4 with textbox3, so far so good ... the problem is that the result of the division appears with the symbol "."
ex: textbox1 insert number 10,5 - textbox2 insert number 2 - then the result is 5,25 ... but 5.25 appears and no longer calculates the multiplication because im multiplying one result with "," and the other has "." if i type in textbox1 or 2 in numbers with "." neither function is performed ... my big question how can I fix this error?

Thank you all.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I am pretty sure you are going to have to, at minimum, post your code so we can see how you are attempting to perform your calculations. Posting your workbook to a file sharing service like DropBox would be even better.
 
Upvote 0
im sorry the code...

Private Sub TextBox2_Change()

On Error Resume Next
Dim v1 As Double
If TextBox1 <> "" Then
v1 = TextBox1
Else
v1 = 0
End If

On Error Resume Next
Dim v2 As Double
If TextBox2 <> "" Then
v2 = TextBox2
Else
v2 = 0
End If

On Error Resume Next
Dim v3 As Double
If TextBox4 <> "" Then
v3 = TextBox4
Else
v3 = 0
End If


TextBox4 = (v1 / v2)



End Sub

Private Sub TextBox4_Change()

On Error Resume Next
Dim v1 As Double
If TextBox4 <> "" Then
v1 = TextBox4
Else
v1 = 0
End If

On Error Resume Next
Dim v2 As Double
If TextBox3 <> "" Then
v2 = TextBox3
Else
v2 = 0
End If

On Error Resume Next
Dim v3 As Double
If TextBox5 <> "" Then
v3 = TextBox5
Else
v3 = 0
End If


TextBox5 = (v1 * v2)

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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