Attribute VB_Name = "Module11" Sub FormatTestit() Dim Luku As Double Luku = 32345.678 MsgBox (Format(Luku, "0.00")) '32345,68 MsgBox (Format(Luku, "0")) '32246 MsgBox (Format(Luku, "# ##0")) '32 346 MsgBox (Format(Luku, "# ##0.00 €")) '32 345,68 € MsgBox (Format(Luku, "0.00 $")) '32345,68 € MsgBox (Format(Luku, "Short Date")) '21.7.1988 MsgBox (Format(Luku, "Long Date")) '21. heinäkuuta 1988 MsgBox (Format(Luku, "dd.mm.yy")) '21.07.88 MsgBox (Format(Luku, "dd.mm.yyyy hh:MM:ss")) '21.07.1988 16:16:19 End Sub Sub FormatCurrencyTestit() Dim Luku As Currency Luku = 32345.678 MsgBox (FormatCurrency(Luku)) '32 345,68 € MsgBox (FormatCurrency(Luku, 0)) '32 346 € MsgBox (FormatCurrency(Luku, 0, , , vbFalse)) '32346 € MsgBox (FormatCurrency(Luku, 1, , True, vbFalse)) '32345,7 € End Sub Sub FormatDateTestit() Dim Pvm As Date Pvm = CDate("1.8.2007 8:00") MsgBox (FormatDateTime(Pvm)) '1.8.2007 8:00:00 MsgBox (FormatDateTime(Pvm, vbShortDate)) '1.8.2007 MsgBox (FormatDateTime(Pvm, vbLongDate)) '1. elokuuta 2007 MsgBox (FormatDateTime(Pvm, vbShortTime)) '08:00 MsgBox (FormatDateTime(Pvm, vbLongTime)) '8:00:00 End Sub Sub FormatNumberTestit() Dim Luku As Double Luku = 32345.678 MsgBox (FormatNumber(Luku)) '32 345,68 MsgBox (FormatNumber(Luku, 1)) '32 345,7 MsgBox (FormatNumber(Luku, 4)) '32 345,6780 MsgBox (FormatNumber(Luku, , , , vbFalse)) '32345,68 MsgBox (FormatNumber(Luku, 0, , , vbFalse)) '32346 MsgBox (FormatNumber(Luku, -1)) '32 345,68 End Sub Sub FormatPercentTestit() Dim Luku As Double Luku = 0.678 MsgBox (FormatPercent(Luku)) '67,80% MsgBox (FormatPercent(Luku, 1)) '67,8% MsgBox (FormatPercent(Luku, 0)) '68% End Sub