troubleshooting Question

Format column and fill with date.

Avatar of ExpressMan1
ExpressMan1Flag for Canada asked on
Microsoft Excel
2 Comments1 Solution496 ViewsLast Modified:
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").End(xlDown).Select
Range("D2").End(xlDown).Select
Selection.Columns.AutoFit

End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros