Ich habe eine generierte Datei von einem System stammt das Datum Format dieser Datei ist wie folgt Mar 28 2016 4:55:54:380PM
mein Skript in VBA erkennt dies nicht als Datum oder eher Excel doesn Erkenne das nicht als Datumsformat, sondern nur als Zeichenfolge. Gibt es anders herum?Datumsinformationen in einem Format Excel erkennt nicht als Datum
Antwort
Sie in einem Kommentar erwähnt, dass Sie nur das Datum brauchen:
Sub dateTest()
Dim d As Date
s = "Mar 28 2016 4:55:54:380PM"
s = Left(s, 11)
d = DateSerial(Year(s), Month(s), Day(s))
Debug.Print d
End Sub
28.03.2016
Um etwas Dataset iterieren:
Sub dateIteration()
Dim d As Date, v As Variant
Dim rng As Range
Set rng = Range("A1:A10")
For Each r In rng
v = Left(r.Value, 11)
d = DateSerial(Year(v), Month(v), Day(v))
' Do something with d
' Print it to worksheet, maybe?
r.Value = d
Next r
End Sub
iterieren nicht zusammenhängende Bereiche mit minimalem Code Krempel:
Sub helperSub()
Call dateIteration(Range("A1:A10"))
Call dateIteration(Range("Z1:Z10"))
Call dateIteration(Range("H1:M89"))
End Sub
Sub dateIteration(rng As Range)
Dim d As Date, v As Variant
For Each r In rng
v = Left(r.Value, 11)
d = DateSerial(Year(v), Month(v), Day(v))
' Do something with d
' Print it to worksheet, maybe?
r.Value = d
Next r
End Sub
Ist das Datumsformat nicht in VBA # MM/TT/JJJJ h: mm: ss.sss PM #?
Yap, deshalb habe ich ein Problem mit diesem .. – 7A65726F
Hier ist ein 2-Leitungscode;)
Ich gehe davon aus, dass die Bereich ist von A1:A20
. Bitte ändern geltenden
Sub Sample()
[A1:A20].NumberFormat = "DD/MM/YYYY"
[A1:A20] = [index(DATE(MID(A1:A20,8,4),MONTH(1&LEFT(A1:A20,3)),MID(A1:A20,5,2)),)]
End Sub
Wenn Sie verstehen wollen, was dieser Code dann die Erklärung sieht, die ich gegeben habe Here
Danke, ich werde auch versuchen, dies :) – 7A65726F
Nur die Reihenfolge des Codes geändert –
- 1. Format Datum als Wochentag
- 2. Cell Datum Format in Excel zeigt Datetime
- 3. Keep Excel Zelle Format als Text mit "Datum wie" Daten
- 4. Schreiben xlwt Daten mit Excel 'Datum' Format
- 5. Elasticsearch: Standardvorlage nicht erkennt Datum
- 6. Dynamischer Tabellenname in Excel als DATUM
- 7. C# Interop Excel-Format wie Excel-Format als Tabelle
- 8. Format Datum als Jahr/Quartal
- 9. Zeige Datum auf Eingabefeld in einem anderen Format als Wert
- 10. VBA Excel 2013 Format Funktion ändert Datum
- 11. Format Datum-Uhrzeit als Jahreszeiten in R?
- 12. iFrame erkennt jsPDF-Ausgabe nicht als PDF-Format
- 13. In Epplus Konvertieren String Datum als Datum in Excel
- 14. Excel erkennt keine Daten
- 15. Excel VBA Format Zelle als benutzerdefinierte "h"
- 16. Format STR_TO_DATE zu einem Datum
- 17. Wie ich eine Spalte Datum in Excel
- 18. Format Datum Feld in Power BI-Dienst
- 19. Datum Zeit Format formatiert nicht
- 20. Format Datum in C#
- 21. java.text.ParseException: Unparseable Datum: "42321" (Es handelt sich um Konvertierung Datum von Excel-Format in Java-Format, nicht über DateFormat.parse.)
- 22. Datum in Zelle formatiert als Datum nicht als Datum erkannt
- 23. String.Format (Format, Datum) ignoriert Format
- 24. Warum erkennt Pillow das JPEG-Format nicht?
- 25. Excel-Import, der Tabellen nicht erkennt
- 26. QFile erkennt nicht file: /// URL-Pfad-Format
- 27. Format Datum in websql
- 28. Format Datum basierend auf Format in JavaScript
- 29. Format Datum in HQL Abfrage
- 30. Format Datum in Kendo Vorlage
wollen Sie das Datum und die Uhrzeit oder Datum brauchen? –
Ich brauche nur das Datum .. – 7A65726F