Format numbers

Status
Not open for further replies.

blelli

Board Regular
Joined
Jul 21, 2013
Messages
73
Dears,

How can I do the following "number formatting" using VBA:

If I write, 118.25; the system will write 118.25
If I write, 18.25; (without the first 1) the system will write 118.25
If I write, 11825; (without the decimal separator) the system will write 118.25
If I write, 1825; (without the first 1,and the decimal separator) the system will write 118.25
If I write, 182; (whitout the first 1, the decimal separator and the last number 5) the system will write 118.20

The numbers I'll use is a a range from 108.00 up to 137.00, varying from 05 to 05, like: 108.00, 108.05, 108.10.. 108.95, 109.00...

How can I do it?
Thanks a lot
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Duplicate: Format numbers with VBA Macro

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule #12 here: Forum Rules).
If you do not receive a response, you can "bump" it by replying to it again, though we advise you to wait 24 hours before doing and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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