I'm in need of some assistance with some data calculations. I ingest data from 24 files. Most of the files have a date that I bring over into column D, but they aren't all formatted the same. Examples of the ingested formatting are:
• Serial Number
• YYYY-MM
• YYYY.MM.DD
• Blank
I'm trying to interrogate the value in column D, and populate column E with the date formatted as "MMM-YY". I'm sure there's a more efficient route than the one I was going down, but here's what I've tried unsuccessfully. I only got about 90 minutes of sleep last night, so maybe that's why I'm extra dumb today.
• Serial Number
• YYYY-MM
• YYYY.MM.DD
• Blank
I'm trying to interrogate the value in column D, and populate column E with the date formatted as "MMM-YY". I'm sure there's a more efficient route than the one I was going down, but here's what I've tried unsuccessfully. I only got about 90 minutes of sleep last night, so maybe that's why I'm extra dumb today.
VBA Code:
Sub FormatTime()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim m As Workbook
Dim mD As Worksheet
Dim c As Range, rng As Range
Dim mDLR As Long
Set m = ThisWorkbook
Set mD = m.Sheets("Data")
Set rng = mD.Range("D2", mD.Range("D" & mD.Rows.Count).End(xlUp))
mDLR = mD.Range("C" & Rows.Count).End(xlUp).Row
For Each c In rng
If c.Value = "" Then
c.Offset(, 1).Value = "N/A"
Else
c.Offset(, 1).Value = "=TEXT(RC[-1],""MMM-YY"")"
End If
Next c
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub