listbox Additem between 2 date range userform

  • Hi,
    Good day, i'm just new to this forum so please do correct me i'm I violate some rules on how to post questions. Here goes my issue with my excel file
    i'm trying to filter data using dates.
    what i'm trying to do is input a date on a textbox.
    Start date and end date.
    i'm having issue displaying it on my listbox
    and the date format as well is in MM/DD/YYYY. Is there a possible way to change the date format to DD/MM/YYYY?


    Thank you.
    Here is my codes.



    CODE HERE



    hoping for your help.

  • Re: listbox Additem between 2 date range userform


    Format() will format a date to a string. Textbox values are always text.


    Dates in VBA userforms can be tricky. What one user has as their format in their Windows Regional Settings might be something else in another's. ActiveX controls can be problematic too because some use 32 bit Windows or 32 bit Excel and some use 64 bit. The best way is to probably make the textbox value read only and make the user run another userform that has more control. I can find an example of that if you like. The more simply way is to use 3 Textbox controls for MDY. One still needs code even then to correct invalid entries.


    Tip: If you paste copied code from the forum, paste and copy to Excel first. That will strip the extra html codes when you paste between code tags.

  • Re: listbox Additem between 2 date range userform


    Can you attach an example workbook.


    Also, when posting code please don't use other tags within the code.

  • Re: listbox Additem between 2 date range userform


    Quote from royUK;800678

    It's not really, violating the rules. Mixing the tags doesn't work.


    I'll take a look later.



    Thanks for spending some time

  • Re: listbox Additem between 2 date range userform


    I've added an error handler to each of the date textboxes and when the user clicks on an entry in the ListBox the other controls are populated

  • Re: listbox Additem between 2 date range userform


    Quote from royUK;800690

    I've added an error handler to each of the date textboxes and when the user clicks on an entry in the ListBox the other controls are populated


    Hi,
    Yes it is working when searching using the date.
    But when searching using the name it is no longer working.
    Where will I input the code for the search to work using name.
    previously when searching for the name it was working.

  • Re: listbox Additem between 2 date range userform


    You never mentioned searching by name. How do want to search by Name? Still between the two dates?

  • Re: listbox Additem between 2 date range userform


    Quote from royUK;800730

    You never mentioned searching by name. How do want to search by Name? Still between the two dates?


    Hi,


    Other options for searching is by name. It can either be by date range or by name. so if I have 3 same names added. Once I search for it. all those 3 names will populate the listbox as well. and if I want to search by date range. same goes. it will populate the listbox within the range date.

  • Re: listbox Additem between 2 date range userform


    Quote from royUK;800730

    You never mentioned searching by name. How do want to search by Name? Still between the two dates?


    i'm trying to search either by date range or by name. if i want to search for example weekly or monthly scores I will search by dates. but there are times that I just need to search all the same name. so that is the time I will search by name. Thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!