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
Code
[COLOR=#333333]Private Sub txtDate_Change()[/COLOR]
[COLOR=#333333]On Error Resume Next[/COLOR]
[COLOR=#333333]Me.txtDate = CDate(Me.txtDate)[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
[COLOR=#333333]Private Sub endDate_Change()[/COLOR]
[COLOR=#333333]Dim ws As Worksheet[/COLOR]
[COLOR=#333333]Dim i As Long[/COLOR]
[COLOR=#333333]On Error Resume Next[/COLOR]
[COLOR=#333333]Me.endDate = CDate(Me.endDate)[/COLOR]
[COLOR=#333333]Me.ListBox1.Clear[/COLOR]
[COLOR=#333333]For i = 2 To Application.WorksheetFunction.CountA(Sheet2.Range("D:D"))[/COLOR]
[COLOR=#333333]If Sheet2.Cells(i, 1).Value >= CDate(Me.txtDate.Text) And _[/COLOR]
[COLOR=#333333]Sheet2.Cells(i, 1).Value <= CDate(Me.endDate.Text) Then[/COLOR]
[COLOR=#333333]Me.ListBox1.AddItem Sheet2.Cells(i, 1).Value[/COLOR]
[COLOR=#333333]Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Sheet2.Cells(i, 2).Value[/COLOR]
[COLOR=#333333]Me.ListBox1.List(ListBox1.ListCount - 1, 2) = Sheet2.Cells(i, 3).Value[/COLOR]
[COLOR=#333333]Me.ListBox1.List(ListBox1.ListCount - 1, 3) = Sheet2.Cells(i, 4).Value[/COLOR]
[COLOR=#333333]Me.ListBox1.List(ListBox1.ListCount - 1, 4) = Sheet2.Cells(i, 5).Value[/COLOR]
[COLOR=#333333]End If[/COLOR]
[COLOR=#333333]Next i[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
Display More
hoping for your help.