ich habe für einen Workshop nachstehendes Makro geschrieben.
Warum wirkt sich der Formatbefehl nicht aus? wenn ich in der Deklaration das "As Single" weglasse, funktioniert es!
Sub EuroRechner()
Const Titel = "EURO-Umrechner - EUR <=> ATS"
Const msg_Eingabe = "Geben Sie den Betrag ein!"
Const msg_Result1 = "Betrag in ATS: "
Const msg_Result2 = "Betrag in EUR: "
Const Kurs = 13.7603
Dim nEingabe As Single
Dim nFremdWg As Single
Dim msg_Result$
nEingabe = Format(Val(InputBox(msg_Eingabe, Titel)), "#,##0.00")
If MsgBox("Sind das EURO?", vbYesNo, "EUR oder ATS?") = vbYes Then
nFremdWg = Format(nEingabe * Kurs, "#,##0.00")
msg_Result = msg_Result2 & nEingabe & vbCrLf & msg_Result1 & nFremdWg
Else
nFremdWg = Format(nEingabe / Kurs, "#,##0.00")
msg_Result = msg_Result1 & nEingabe & vbCrLf & msg_Result2 & nFremdWg
End If
MsgBox msg_Result, vbInformation, Titel
End Sub
Danke
Heinz