Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

dates vba

ResolvedVersion 2016

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

Wed 17 Jan 2018: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Use shortcut keys to select rows or columns

Most users use the mouse to select rows or columns. It may be more convenient to use keyboard shortcuts to do that.

The shortcut key combination to select an entire row is Shift+Spacebar.

The shortcut key combination to select an entire column is Ctrl+Spacebar.

These are pretty easy to remember as the spacebar looks like a long row (or column if you're looking at it sideways). Remember that Ctrl, beginning with C, selects columns and Shift, by a process of elimination, the rows.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.