Clever-Excel-Forum

Normale Version: Datum wird nicht von SUMMEWENNS erkannt
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Ha((o

Ich trage mithilfe von VBA Programm Datum in meine Spalte ein. Wenn ich dann in der Spalte mit SUMMEWENNS die Zellen filtere uns auswerte erkennt er nicht immer das Datum. Wenn ich das Datum dann manuell eintrage, funktioniert es. Das Format stimmt. Hmmm. Hat jemand eine Idee?

Grüße
Hi,

das klingt für mich, als ob du in deinem Makro das Format in irgendeiner Form auf Text gestellt hast.
Hola,


Zitat:Das Format stimmt.


=istzahl(Zelle_mit_Datum)

Was kommt da raus?

Gruß,
steve1da
Tatsächlich. Es kommt an vielen Stellen ein Text, d.h. Istzahl(zelle) = FALSCH.
Aber was mache ich dann beim Ablegen falsch? Ich nehme die Zahl aus einer Textbox. S. Code. Normale Zahlen werden korrekt übernommen. Aber ein Datum wird als Text eingetragen.

Code:
With GescannteBelege
       Cells(zeile, s2).Value = .TextBox1.Value
       If Cells(zeile, s3).Value = "" Then
           Cells(zeile, s3).Value = .TextBox1.Value
       End If
       Cells(zeile, s4).Value = .TextBox2.Value
       Cells(zeile, s5).Value = .TextBox3.Value
       
       If Cells(zeile, s6).Value = "" Then
           Cells(zeile, s6).Value = .TextBox1.Value
       End If
       If Cells(zeile, s7).Value = "" Then
           Cells(zeile, s7).Value = .TextBox1.Value
       End If
       Cells(zeile, s9).Value = .TextBox5.Value / 100
       If Not .TextBox4 = "" Then
           Cells(zeile, s8).Value = .TextBox4.Value
       ElseIf Not .TextBox6 = "" Then
           Cells(zeile, s10).Value = .TextBox6.Value
       End If
   End With


Habt Ihr einen weiteren Tip für mich?
Grüße
Moin!
Ohne Angabe, was Du tatsächlich in die Datumstextbox einträgst, bleibt es Spekulation.
Ein gültiges Datum kann man wie folgt in eine Textbox eintragen:
D-M[-Y]
D.M[.Y]
D/M[/Y]
Heißt:
Ein- oder zwei(vier)-stelliger Tag/Monat/Jahr.
Jahr ist optional und wird nur bei Abweichen vom aktuellen Jahr benötigt.

Eintrag niemals ohne Prüfung:
If IsDate(TextBox1) Then Zelle.Value = CDate(TextBox1) Else TextBox1.Text = ""

Gruß Ralf
Danke.

Das war eine flotte Antwort. Smile
Das Format ist dd.mm.yyyy. Wird in der Textbox auch immer richtig angepasst.

Habe Deine Abfrage und Formatdef. übernommen. Funktioniert perfekt. Ich danke sehr.

Viele Grüße