Assume Decimals

G

Guest

Guest
I am having a problem writing a piece of code in excel to move a dollar figure ie. 458.23 to 45823. The bank wants to assume the decimal then format it. So it would look something like this 000000045823. It has to be in VB because I import all the info from a text file format it and convert it back to a txt file for the bank.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I need a piece of code. I am using numberformat in VB to assume the "0" in front of the amount. I need something to either move the number to the left 2 spaces. Or a formula to use inside the cell to multiply by 100
 
Upvote 0
How is the text file you import laid out? One column or multi column? If Multi column, how is it delimited? You should be able to do the multiplcation when you import the file.
 
Upvote 0
The file is delimited with comas. Do you know code that would multiply when I import it?
 
Upvote 0
I have time to explain a little now. I have a checking statement that gets exported from a UNIX box. It exports account number, check number, amount, and date. They all have to have leading "0" which I did with formatnumber. I have everything working except the amount field when I export. When I format the amount I lose the decimal. So if the txt file from the UNIX system says 452.23 I import it, format it using formatnumber("000000000000"). I get 000000000452. I am missing something simple.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,485
Members
448,967
Latest member
visheshkotha

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