Excel number to date

I've looked a lot but cannot find solution to match my query.
I get data sent to me each week, but when converted to excel, the dates end up being this format nn/nn.
So for instance 29th April would be 29/04, but my formulas don't see 29/04 as a date.
Is there a way I can convert this string to a date using vba? The dates are all in row 1 by the way.
Stephen ByromWarehouse/ShippingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
When you say all dates are in row-1..If i understand that correctly you meant to say dates are in a1,b1,c1 or you meant to say dates are in a1,a2,a3??

Stephen ByromWarehouse/ShippingAuthor Commented:
All dates are in row 1.
i.e. a1 b1 c1 etc etc
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Basic question: What is really stored in those cells? Are it dates formatted nn/nn, or the string? If you click on a cell, what does it display in the formular bar above the sheet?
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Stephen ByromWarehouse/ShippingAuthor Commented:
it displays 30/04, for example
Saurabh Singh TeotiaCommented:
You can use the following code it will do what you are looking for..

Sub convertdates()
    Dim rng As Range, cell As Range
    Dim lcol As Long

    lcol = Cells(1, Cells.Columns.Count).End(xlToLeft).Column
    Set rng = Range("A1:" & Cells(1, lcol).Address)

    For Each cell In rng

        cell.TextToColumns Destination:=cell, DataType:=xlDelimited, FieldInfo:=Array(1, 4), TrailingMinusNumbers:=True
    Next cell

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stephen ByromWarehouse/ShippingAuthor Commented:
Thank you for your time
Saurabh Singh TeotiaCommented:
Yw Stephen..  :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.