ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format a Cells value within a MsgBox (https://www.excelbanter.com/excel-programming/370511-format-cells-value-within-msgbox.html)

PCH

Format a Cells value within a MsgBox
 
How would I format the following values cell values to:
Range("F62").Value "Format Value to #,##0,0"
Range("F63").Value "Format Value to $#,##0.00"

Dim Msg, Style, Title, Response, MyString
Msg = "Are you sure you want to delete Quantities?" & vbCr & vbCr _
& "No of Items:" & vbTab & Range("f61").Value & vbCr _
& "Tonnes:" & vbTab & vbTab & Range("F62").Value & vbCr _
& "Price:" & vbTab & vbTab & "$" & Range("F63").Value " & vbCr '
Define message."
Style = vbYesNo + vbExclamation + vbDefaultButton2 ' Define buttons.
Title = "Last Chance!!!" ' Define title.
Response = MsgBox(Msg, Style, Title)


Bob Phillips

Format a Cells value within a MsgBox
 
Dim Msg, Style, Title, Response, MyString
Msg = "Are you sure you want to delete Quantities?" & vbCr & vbCr _
& "No of Items:" & vbTab & Range("f61").Value & vbCr _
& "Tonnes:" & vbTab & vbTab & _
Format(Range("F62").Value, " #,##0,0") & vbCr _
& "Price:" & vbTab & vbTab & "$" & _
Format(Range("F63").Value, " #,##0,0.00") & vbCr

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"PCH" wrote in message
...
How would I format the following values cell values to:
Range("F62").Value "Format Value to #,##0,0"
Range("F63").Value "Format Value to $#,##0.00"

Dim Msg, Style, Title, Response, MyString
Msg = "Are you sure you want to delete Quantities?" & vbCr & vbCr _
& "No of Items:" & vbTab & Range("f61").Value & vbCr _
& "Tonnes:" & vbTab & vbTab & Range("F62").Value & vbCr _
& "Price:" & vbTab & vbTab & "$" & Range("F63").Value " & vbCr '
Define message."
Style = vbYesNo + vbExclamation + vbDefaultButton2 ' Define buttons.
Title = "Last Chance!!!" ' Define title.
Response = MsgBox(Msg, Style, Title)




drawlings[_7_]

Format a Cells value within a MsgBox
 

I am not sure if you mean Format the values within the cell or msgbox.

Within the msgbox Statement you can use

FormatNumber(Range("F62").Value)
FormatCurrency(Range("F63").Value,2)

Msg = "Are you sure you want to delete Quantities?" & vbCr & vbCr _
& "No of Items:" & vbTab & Range("f61").Value & vbCr _
& "Tonnes:" & vbTab & vbTab & FormatNumber(Range("F62").Value) & vbC
_
& "Price:" & vbTab & vbTab & "$" & FormatCurrency(Range("F63").Value,2
" & vbCr

--
drawling
-----------------------------------------------------------------------
drawlings's Profile: http://www.excelforum.com/member.php...fo&userid=3662
View this thread: http://www.excelforum.com/showthread.php?threadid=57210



All times are GMT +1. The time now is 10:22 AM.

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