Hi all - just stumbled upon this forum and am AMAZED by the knowledge that is shared here. What a great community!
I've got a spreadsheet that was downloaded from a vendor in CSV format. When opened the date cell looks like this:
6112010
5152010
9032010
5152010
6122010
10222010
The format is dmmyyyy or ddmmyyyy depending on the month. I need to try and get this in to a standard xx/xx/yyyy or yyyy/xx/xx format. I found in the archives this little ditty:
I think that could get me mostly there BUT I have the problem of some dates having 2 numbers for the month column (10-12) and some having 1 number (1-9) for the month column. Could someone advise me on how to add a 0 to the front of the date for all of the 1-9 months? I think if I get that I could easily run the above macro and format the date from there. Thanks!
I've got a spreadsheet that was downloaded from a vendor in CSV format. When opened the date cell looks like this:
6112010
5152010
9032010
5152010
6122010
10222010
The format is dmmyyyy or ddmmyyyy depending on the month. I need to try and get this in to a standard xx/xx/yyyy or yyyy/xx/xx format. I found in the archives this little ditty:
Code:
Sub Macro1()
Dim rg As Range
Dim ocell As Range
Dim temp As String
Set rg = Selection
For Each ocell In rg
temp = Left(ocell, 4) & "/" & Mid(ocell, 5, 2) & "/" & Right(ocell, 2)
ocell = temp
Next
End Sub
I think that could get me mostly there BUT I have the problem of some dates having 2 numbers for the month column (10-12) and some having 1 number (1-9) for the month column. Could someone advise me on how to add a 0 to the front of the date for all of the 1-9 months? I think if I get that I could easily run the above macro and format the date from there. Thanks!