ExpressMan1
asked on
Format column and fill with date.
Hello,
I have column D with data in general format which are Invoice Dates. Example:
20130910
20130910
20130910
I am trying to get column C to show the dates as 10/09/2013
Here is the code I am using. I am getting type mismatch error.
Sub Invoice_Date()
Sheets("Sheet1").Select
Columns("C:C").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Selection.Formula "=DATEVALUE(MID(D2,5,2)&" / "&RIGHT(D2,2)&" / "&LEFT(D2,4))"
Selection.AutoFill Destination:=Range("C2").E nd(xlDown) .Select
Range("D2").End(xlDown).Se lect
Selection.Columns.AutoFit
End Sub
I have column D with data in general format which are Invoice Dates. Example:
20130910
20130910
20130910
I am trying to get column C to show the dates as 10/09/2013
Here is the code I am using. I am getting type mismatch error.
Sub Invoice_Date()
Sheets("Sheet1").Select
Columns("C:C").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Selection.Formula "=DATEVALUE(MID(D2,5,2)&" / "&RIGHT(D2,2)&" / "&LEFT(D2,4))"
Selection.AutoFill Destination:=Range("C2").E
Range("D2").End(xlDown).Se
Selection.Columns.AutoFit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER