How to create a date conversion in MS Excel using VBA

S

Sandspirit

Hi,

I have a file that is imported from Attachmate Extra!. The dates appear
in Excel as i.e. 106/04/14, which represents April 14, 2006. How can I
convert all these dates to the standard 04/14/2006 format using VBA? I
have NEVER seen a date format like the one from Attachmate. Please
help.

Thanks!

Sandspirit
 
A

aidan.heritage

As an example
dim n as string
n=range("B1").value
Range("b1").Value = DateSerial(Left(n, 3) + 1900, Mid(n, 5, 2),
Right(n, 2))


would put the value from B1 into a proper date format - you can
obviously extend this to work across all cells in a range
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top