Hi,
I am trying to Automate filling a Column with a correct format date when I download a sheet with dates in the Format 'YYYYMMDD'.
What I am trying to Do:
Insert Column, Insert Formula, Autofill to bottom of Data, Copy Results and Paste as Values, Convert to Excel Date Formatting. Delete Original Column. So Far this is almost working But I have a problem with AutoFilling the Entire Sheet.
Code:
How can I change it so that only Cells with Values in them are converted, Without getting #VALUE to the end of the Sheet?
Rgds
Bailer
I am trying to Automate filling a Column with a correct format date when I download a sheet with dates in the Format 'YYYYMMDD'.
What I am trying to Do:
Insert Column, Insert Formula, Autofill to bottom of Data, Copy Results and Paste as Values, Convert to Excel Date Formatting. Delete Original Column. So Far this is almost working But I have a problem with AutoFilling the Entire Sheet.
Code:
Code:
Sub Dates2()
'
' Dates2 Macro
'
'
' Date Formula
Selection.EntireColumn.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=DATE(LEFT(RC[1],4),MID(RC[1],5,2),RIGHT(RC[1],2))"
ActiveCell.Select
' Autofill Section
Range(Selection, Selection.End(xlDown)).Select
Selection.FillDown
' Good from here
Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "m/d/yyyy"
ActiveCell.Offset(0, -1).Columns("A:A").EntireColumn.Select
Selection.Delete Shift:=xlToLeft
ActiveCell.Select
Calculate
End Sub
How can I change it so that only Cells with Values in them are converted, Without getting #VALUE to the end of the Sheet?
Rgds
Bailer