Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Lolo 25 ani
Femeie
25 ani
Galati
cauta Barbat
25 - 52 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Date Column Not Sorting Properly Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
I extract some data from SAP directly to Excel and for some reason, in a Table, the dates pasted into the date column would not sort as date. Would show as date, so conversion to date wouldn't work. I tried some macros found online and the one that worked turned my days into months and months into days. So it didn't work as intended.

The following works for me, and I embedded it into the SAP data extraction code, but here's a standalone macro that will fix your date in Selection:


' added to main ZN_extrage macro
Sub Date_Correct()
Application.ScreenUpdating = False

Dim DT As Date      ' date variable
Dim rng As Range
Set rng = Selection

For Each cell In rng
    DT = cell.Value ' store cell value to variable
    cell.Clear      ' clear cell value
    cell.Value = DT ' insert variable value to cell
Next cell

Application.ScreenUpdating = True
End Sub


pus acum 1 an
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
updated

pus acum 1 an
   
Pagini: 1  

Mergi la