DOC Office Consulting

DOC News

Read a date in Australian format (dd/mm/yyyy)

If you’re working with dates in VBA – it can be a little painful when the date format defaults to US format (mm/dd/yyyy).
Sure when you enter 30/10/1979 (my birthday incidentally), it knows it’s the 30th October because there is no 30th month, but when you enter 03/05/1957 (my dad’s birthday), it reads it as 5th March instead of 3rd May. Gah!
Getting Excel to recognise the date you’ve entered as dd/mm/yyyy can be very frustrating, so I use a function to make sure it’s recognised in the format I need it.
The function reads the text between the forward slashes (to return the date/month/year indivudually) and turns into an actual date, presenting it in any format I choose. It also negates the need to ensure that users enter the date in dd/mm/yyyy. No matter how important it is to you, non-programmers/coders will never understand why d/m/yy isn’t good enough and blame you for the ‘bugs’.
If you get stuck needing a date entered in UK format, try the function out – you won’t regret it.

View the code here:
Read Danielle O'Connell's answer to I'm trying to make a VBA function that takes a date in the form mm/dd/yyyy and writes a string with this and other information. To make my question simple, how can I get this to spit a date out? on Quora

Or download a sample file with the code unlocked here:
Download

UA-107044862-1