dss28
Board Regular
- Joined
- Sep 3, 2020
- Messages
- 165
- Office Version
- 2007
- Platform
- Windows
I have a userform and 2 sheets - sheet2 and sheet6.
While entering a quantity in number through userform, data stored on sheet 2 is same as entered. Simultaneously the data is then copied to sheet 6 as current stock. However the sheet 6 shows rounded off number eg. if my input value is 1.75 it round up to 2 or if it is 0.25 it shown as 0 on the sheet 6.
in both sheets, the column is formatted as number with 4 decimal places. even then it is rounded off.
request help in resolving.
While entering a quantity in number through userform, data stored on sheet 2 is same as entered. Simultaneously the data is then copied to sheet 6 as current stock. However the sheet 6 shows rounded off number eg. if my input value is 1.75 it round up to 2 or if it is 0.25 it shown as 0 on the sheet 6.
in both sheets, the column is formatted as number with 4 decimal places. even then it is rounded off.
request help in resolving.
VBA Code:
Private Sub CommandButton1_Click()
Dim I As Integer
Dim j As Integer
Dim final As Integer
Dim actual As Integer
For I = 1 To 1000
If Sheet2.Cells(I, 1) = "" Then
final = I
Exit For
End If
Next
Sheet2.Cells(final, 1) = UserForm2.ComboBox1
Sheet2.Cells(final, 2) = UserForm2.TextBox1
Sheet2.Cells(final, 3) = UserForm2.TextBox2
Sheet2.Cells(final, 4) = UserForm2.TextBox4
Sheet2.Cells(final, 5) = UserForm2.TextBox6
Sheet2.Cells(final, 6) = UserForm2.TextBox7
Sheet2.Cells(final, 7) = UserForm2.TextBox9
Sheet2.Cells(final, 8) = UserForm2.TextBox10
Sheet2.Cells(final, 9) = UserForm2.TextBox11
Sheet2.Cells(final, 10) = UserForm2.TextBox12
For j = 1 To 1000
If sheet6.Cells(j, 1) = Sheet2.Cells(final, 1) Then
actual = sheet6.Cells(j, 3)
final = UserForm2.TextBox2 + actual
sheet6.Cells(j, 3) = final
Exit For
End If
Next
UserForm2.ComboBox1 = ""
UserForm2.TextBox1 = ""
UserForm2.TextBox2 = ""
UserForm2.TextBox4 = ""
UserForm2.TextBox6 = ""
UserForm2.TextBox7 = ""
UserForm2.TextBox8 = ""
UserForm2.TextBox9 = ""
UserForm2.TextBox10 = ""
UserForm2.TextBox11 = ""
UserForm2.TextBox12 = ""
End Sub