Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I have a user form userform1) with a textbox (uf1tb1_wholeqty) in which the user enters a whole number, and a combobox (uf1cbx5_prtqty) from which the user is to select from a choice of four fractions (.00,.25, .50, .75)
With VBA, I need to combine the two to make a number.
eg uf1tb1_wholeqty = 1; uf1cbx5_prtqty = .75; result = 1.75
Here is my code ...
Enter the values of the example, the result is 10.75. What I believe is part of the issue is that after the the user selects the fractional quantity and exits, the combobox populates with a leading zero. So although the user selects ".75" from the list, when he exist, the value in the box changes to 0.75.
I tried this too with no change in the result.
How can I best overcome this?
With VBA, I need to combine the two to make a number.
eg uf1tb1_wholeqty = 1; uf1cbx5_prtqty = .75; result = 1.75
Here is my code ...
Code:
.Range("G" & trow) = UserForm1.uf1tb1_wholeqty.Value + UserForm1.uf1cbx5_prtqty.Value
Enter the values of the example, the result is 10.75. What I believe is part of the issue is that after the the user selects the fractional quantity and exits, the combobox populates with a leading zero. So although the user selects ".75" from the list, when he exist, the value in the box changes to 0.75.
I tried this too with no change in the result.
Code:
.Range("G" & trow) = CStr(UserForm1.uf1tb1_wholeqty.Value) + CStr(UserForm1.uf1cbx5_prtqty.Value)
How can I best overcome this?