Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:18:55+00:00 2026-06-05T16:18:55+00:00

When passing a date from datepicker to sort an excel table, somewhere the format

  • 0

When passing a date from datepicker to sort an excel table, somewhere the format is getting confused and swapping from dd/mm/yyyy to mm/dd/yyyy

I have checked my regional settings and they are set to dd/mm/yyy

Sub sortFuel()

With UserForm1
    With .dp_StartDate
        startDate = Format(.Value, "dd/mm/yyyy")
    End With
    With .dp_EndDate
        endDate = Format(.Value, "dd/mm/yyyy")
    End With
End With

MsgBox startDate
MsgBox endDate

With ws
    .ListObjects("Table_DFDBMain_FuelTrans4").Range.AutoFilter Field:= _
    3, Criteria1:=">=" & Format(startDate, "dd/mm/yyyy"), Operator:=xlAnd, Criteria2:="<=" & Format(endDate, "dd/mm/yyyy")
End With

End Sub

The columns in my table are already sorted in dd/mm/yyyy, yet if i select 7th May 2012, it comes out 5th July, 2012. NOTE: it only flips if the day column is less than 12. If for example i select 24th June for start date, it will stay 24th June.

Any help will be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:18:56+00:00Added an answer on June 5, 2026 at 4:18 pm

    Try this

    Sub sortFuel()
        Dim D1 As Long, D2 As Long
    
        With UserForm1
            With .dp_StartDate
                startDate = Format(.Value, "dd/mm/yyyy")
            End With
            With .dp_EndDate
                endDate = Format(.Value, "dd/mm/yyyy")
            End With
        End With
    
        D1 = Val(Format(startDate, "0"))
        D2 = Val(Format(endDate, "0"))
    
        With ws
            .ListObjects("Table_DFDBMain_FuelTrans4").Range.AutoFilter Field:= _
            3, Criteria1:=">=" & D1, Operator:=xlAnd, Criteria2:="<=" & D2
        End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm passing a date from Ruby to Javascript via JSON. It comes into Javascript
Hi at all I want to parsing a date from XML with this format:
My Jquery date selector is passing my date variable in the format 22+Mar+2012 but
We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I have a column in a table in which we are storing date in
I have a table which containt a date, a number for the number of
I have a table that has multiple records with a start date (PlacementDate) and
I have an abstract base class (Comparable) with Date and Time virtually inheriting from
I have a table of user-generated content that includes an ENUM format column for
In flex (flash builder 4) I have a Date() property that I am passing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.