ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting a MsgBox number (https://www.excelbanter.com/excel-programming/291234-formatting-msgbox-number.html)

Otto Moehrbach[_6_]

Formatting a MsgBox number
 
Excel 2003, WinXP
Programming:
I have a cell variable FoundCell.
The value of FoundCell is 1.2. It can be any numerical value.
FoundCell is formatted as Currency, dollar sign 2 places, so the cell
appears as $1.20.
I want to put this value into a MsgBox and have it appear as $1.20
IOW, I want MsgBox FoundCell.Value to produce $1.20

I tried using Len(Application.WorksheetFunction.Mod..........) to determine
the length of the remainder so I could append zeros as needed but I don't
thing the worksheet Mod function will work in this manner.

I tried Application.WorksheetFunction.Text.... and that didn't work.
Is there a way to do this? Thanks for your help. Otto



Bob Phillips[_6_]

Formatting a MsgBox number
 
Hi again Otto,

Try

MsgBox Format(FoundCell.Value,"$#,##0.00")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Otto Moehrbach" wrote in message
...
Excel 2003, WinXP
Programming:
I have a cell variable FoundCell.
The value of FoundCell is 1.2. It can be any numerical value.
FoundCell is formatted as Currency, dollar sign 2 places, so the cell
appears as $1.20.
I want to put this value into a MsgBox and have it appear as $1.20
IOW, I want MsgBox FoundCell.Value to produce $1.20

I tried using Len(Application.WorksheetFunction.Mod..........) to

determine
the length of the remainder so I could append zeros as needed but I don't
thing the worksheet Mod function will work in this manner.

I tried Application.WorksheetFunction.Text.... and that didn't work.
Is there a way to do this? Thanks for your help. Otto





Tom Ogilvy

Formatting a MsgBox number
 
msgbox FoundCell.Text

is another way.

--
Regards,
Tom Ogilvy


Otto Moehrbach wrote in message
...
Excel 2003, WinXP
Programming:
I have a cell variable FoundCell.
The value of FoundCell is 1.2. It can be any numerical value.
FoundCell is formatted as Currency, dollar sign 2 places, so the cell
appears as $1.20.
I want to put this value into a MsgBox and have it appear as $1.20
IOW, I want MsgBox FoundCell.Value to produce $1.20

I tried using Len(Application.WorksheetFunction.Mod..........) to

determine
the length of the remainder so I could append zeros as needed but I don't
thing the worksheet Mod function will work in this manner.

I tried Application.WorksheetFunction.Text.... and that didn't work.
Is there a way to do this? Thanks for your help. Otto





Otto Moehrbach[_6_]

Formatting a MsgBox number
 
Bob, Tom
What can I say? Thanks again. Otto
"Tom Ogilvy" wrote in message
...
msgbox FoundCell.Text

is another way.

--
Regards,
Tom Ogilvy


Otto Moehrbach wrote in message
...
Excel 2003, WinXP
Programming:
I have a cell variable FoundCell.
The value of FoundCell is 1.2. It can be any numerical value.
FoundCell is formatted as Currency, dollar sign 2 places, so the cell
appears as $1.20.
I want to put this value into a MsgBox and have it appear as $1.20
IOW, I want MsgBox FoundCell.Value to produce $1.20

I tried using Len(Application.WorksheetFunction.Mod..........) to

determine
the length of the remainder so I could append zeros as needed but I

don't
thing the worksheet Mod function will work in this manner.

I tried Application.WorksheetFunction.Text.... and that didn't work.
Is there a way to do this? Thanks for your help. Otto








All times are GMT +1. The time now is 12:22 PM.

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