I've never used the CDate function, and after some research, it looks like that's what I should use, but I'm not understanding "how", as my data set seems to differ from the examples I've seen online. In column C of my worksheet, I have some entries of dates that are stored as text. Example: 030621. I'm trying to convert that to 03/06/21.
If I run the first example, I get a returned value of 06/19/82.
If I run the second example, I get a type mismatch error.
I'm sure I'm doing something wrong, but I haven't been able to identify what it is.
If I run the first example, I get a returned value of 06/19/82.
VBA Code:
With mws.Range("C2:C" & mLR)
'.Value = Format(CDate(Cells(.Value, "######")), "MM/DD/YY")
.NumberFormat = "MM/DD/YY"
.Value = .Value
End With
If I run the second example, I get a type mismatch error.
VBA Code:
With mws.Range("C2:C" & mLR)
.Value = Format(CDate(Cells(.Value, "######")), "MM/DD/YY")
'.NumberFormat = "MM/DD/YY"
'.Value = .Value
End With
I'm sure I'm doing something wrong, but I haven't been able to identify what it is.