ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting currency with the cents but without the decimal point (https://www.excelbanter.com/excel-programming/443812-formatting-currency-cents-but-without-decimal-point.html)

mrbobader

Formatting currency with the cents but without the decimal point
 
I'm using VB through MS Excel and I needs to export check information in a text
format. The
bank is requiring that all fields take x number of characters, which I have
been
able to do except that the check amount needs to read 11 digits without
the decimal place. ie: $247.84 becomes 0000024784. I can get it to
00000247.84 with the vAmt = Format(Sheet1.Cells(i, 4),
"00000000.00")
but the minute I
take out the decimal, I get a decimal, I get 0000000247.

Note: vAmt is:
Dim vAmt As String

Bob Phillips[_4_]

Formatting currency with the cents but without the decimal point
 
Try

vAmt = Replace(Format(Sheet1.Cells(i, 4),"00000000.00"),".","")


HTH

Bob

"mrbobader" wrote in message ...

I'm using VB through MS Excel and I needs to export check information in a
text
format. The
bank is requiring that all fields take x number of characters, which I have
been
able to do except that the check amount needs to read 11 digits without
the decimal place. ie: $247.84 becomes 0000024784. I can get it to
00000247.84 with the vAmt = Format(Sheet1.Cells(i, 4),
"00000000.00")
but the minute I
take out the decimal, I get a decimal, I get 0000000247.

Note: vAmt is:
Dim vAmt As String


Ron Rosenfeld[_2_]

Formatting currency with the cents but without the decimal point
 
On Mon, 25 Oct 2010 05:56:54 -0500, mrbobader
wrote:

I'm using VB through MS Excel and I needs to export check information in a text
format. The
bank is requiring that all fields take x number of characters, which I have
been
able to do except that the check amount needs to read 11 digits without
the decimal place. ie: $247.84 becomes 0000024784. I can get it to
00000247.84 with the vAmt = Format(Sheet1.Cells(i, 4),
"00000000.00")
but the minute I
take out the decimal, I get a decimal, I get 0000000247.

Note: vAmt is:
Dim vAmt As String



vAmt = Format(Sheet1.Cells(i, 4) * 100, "00000000000")



All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com