format values in MsgBox?

  • Thread starter Thread starter NorTor
  • Start date Start date
N

NorTor

Hello,

I would like to give the user of an application feedback on found data
after a search in a simple msgbox.

the box will contain date, some integers and a few decimal values.
Problem is; how do I format some figures to have, say 2 decimals
shown, use 'thousand-separator' etc? Can I use something like
NumberFormat = "#,##0.00" in separate items of the msgbox?

Here is my code:
For j = 3 To cellsDown
If loanNumber = Cells(j, 19).Value Then
MsgBox ("Følgende lån funnet:") & vbCrLf & vbCrLf & "Låntaker: " &
Cells(j, 3).Value _
& vbCrLf & "Valuta: " & Cells(j, 9).Value & vbCrLf & "Credit: " &
Cells(j, 7).Value _
& vbCrLf & "SLS Lån: " & Cells(j, 8).Value & vbCrLf & "Dato
utbetalt: " & Cells(j, 25).Value _
& vbCrLf & "Beløp utbetalt: " & Cells(j, 26).Value & vbCrLf &
"Kurs utbetalt: " & Cells(j, 27).Value _
, vbYesNo, "Detaljer"
Exit Sub
End If
Next j



Best regards,
NorTor
 
Use either the format function

Format(Cells(j,9).Value,"#,##0.00")

or if the cells are formatted they way you want

Use Cells(j,9).Text in your string rather than Cells(j,9) or
Cells(j,9).value
 
Ten minutes after I send my request, Tom gives me a perfect solution!
Thank you so much Tom, I really appreciate your help!


Best regards,
NorTor
 
Back
Top