User Form Text box number to Excel

Nikijune

Board Regular
Joined
Aug 16, 2016
Messages
51
Hi all,

Apologies for the terrible title.

I have a user form where the user enters the total number of hours they were at work for. In most cases it is 7 and everything is fine, however, for part time staff, when they enter 5.5 and click the submit button, the data that gets published to excel shows '0'

I have tried setting the max length to 5. I have formatted the textbox within the user form to '0.00' and '0.0' but it is still not publishing the number entered.

Any ideas excel fam?
 
The values in textboxes on a userform are, well, text so if you want them to be treated as numeric you need to convert them.

You are already doing that for some of the textboxes using DateValue but you don't do it for any of the others.

Try using one of the various conversion functions VBA has, for example Val, CLng, CDbl etc.
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi Norie,

Thanks for your suggestion and apologies for taking so long to actually getting round to testing it out.

I have tried formatting the textbox in every way I can possibly think of and it is still publishing the decimal numbers as '0' apart from anything that is '.75'

Why is it that I can publish to this decimal place, but not to a half or a quarter decimal???
 
Upvote 0
Hi world,

Any other thoughts on this problem that I am experiencing???

Causing so many issues :(

Thanks in advance :)
 
Upvote 0
Hi Mike,

Thanks for the reply :)

That bit of the code is not referencing the text box that I am trying to enter the decimal numbers in to. I have still tried changing it to a value, but alas it is not working.

As this is causing us quite a lot of issues with our reporting, I was tryig my hardest to find a solution, and have worked out that if we entered 5.501 that it would publish this number, I just cant understand why it wont publish 5.5 :confused::mad::(
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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