Format a Cells value within a MsgBox

P

PCH

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)
 
B

Bob Phillips

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)
 
D

drawlings

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top