Michael has attended:
No courses
Dates in VBA
Currently I have a macro which runs a filter to look for all rows in the sheet which are before the date entered in cell E11 on a different sheet.
The code works perfectly but it is using an American date format (MM/DD/YYYY) despite the cell in question being formatted as DD/MM/YYYY. Is there a way to change this so that the content of the cell can be entered in UK format and VBA will interpret it as such?
RE: Dates in VBA
Hi Michael,
Thank you for the forum question.
Dates in many tools in VBA can be a nightmare. Yes many tools turn them to US dates.
try: format(range("E11"),"dd/mm/yyyy")
The CDate function is another option
= CDate("TheUsDate")
I have wasted a lot of time struggling with the same issue. I have always been able to get it right but with different tools and solutions.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector