![]() |
format values in MsgBox?
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 |
format values in MsgBox?
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 -- Regards, Tom Ogilvy "NorTor" wrote in message ... 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 |
format values in MsgBox?
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 On Tue, 9 Sep 2003 09:09:56 -0400, "Tom Ogilvy" wrote: 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 |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com