Forum Discussion

MHT1974's avatar
MHT1974
Copper Contributor
Apr 07, 2025

Re: VBA to convert MMM DD YYYY to date

hi hans, hope you are well.
i did both the attachment and the screenshot, but maybe the upload get's blocked by our IT.
here's a sample block of the full file below. hope that helps with the dates in Col D would need to be converted pls if they aren't in date format or ignored if they stem from other headers.

 

DOCUMENT TYPEINVOICE NUMBERCURRENCYBILLING CYCLE DATE
xxxxEUR10-Dec-24
xxxxEURAUG 14 2024
xxxxEURAUG 14 2024
xxxxEURAUG 14 2024
xxxxEURAUG 14 2024
xxxxEURBILLING CYCLE DATE
xxxxEURBILLING CYCLE DATE
xxxxEURJUL 29 2024
xxxxEURJUL 29 2024

 

2 Replies

  • Thank you. Try this:

    Sub Convert2Date()
        Dim rng As Range
        Dim cel As Range
        Application.ScreenUpdating = False
        On Error Resume Next
        Set rng = Range(Range("D2"), Range("D" & Rows.Count).End(xlUp))
        rng.NumberFormat = "m/d/yyyy"
        For Each cel In rng
            cel.Value = CDate(cel.Value)
        Next cel
        Application.ScreenUpdating = True
    End Sub

     

    • MHT1974's avatar
      MHT1974
      Copper Contributor

      This works a treat now, thx so much Hans for all the help - much appreciated.
      All the Best, Markus

Resources