View Full Version : AutoFilter Not Working By Date Due To Date Format Difference DD/MM/YYYY Vs MM/DD/YYYY
marreco
01-02-2014, 02:40 AM
Hi folks
i am desperate and so, i did the cross-posting
I have two combobox cmb_Dt_Inc (start date) and cmb_Dt_Fin (end date).
I need show result in ListView.
Cross-Post
Filter by Date and Show in LisView (http://www.excelforum.com/excel-programming-vba-macros/977657-filter-by-date-and-show-in-lisview.html)
Thanks
Excel Fox
01-04-2014, 03:43 PM
Hi Marreco,
Replace the function with this
Public Sub ComboboxChange(cmbTarget As MSForms.ComboBox, iComboboxNo As Integer)
Dim iColumnNo As Integer
' Muda a cor se tiver conteúdo
If cmbTarget.Value = vbNullString Then
cmbTarget.BackColor = &HFFFFFF
Else: cmbTarget.BackColor = &H80C0FF
End If
' seleciona a planilha fliltro e coloca o valor da combo
iColumnNo = iComboboxNo
If IsDate(cmbTarget.Value) Then
Sheets("Filtro").Cells(2, iColumnNo) = CDate(cmbTarget.Value)
Else
Sheets("Filtro").Cells(2, iColumnNo) = cmbTarget.Value
End If
Call Pesquisa
End Sub
marreco
01-04-2014, 05:58 PM
Hi.
works, but when I use another combobox (cmb_Dt_Fin) are filtering only the last action of the combox.
See my image
thank you!!
marreco
02-02-2014, 05:02 AM
Hi.
any idea?
thanks
Excel Fox
02-03-2014, 07:01 PM
marreco, that is because of the way you have setup your filtering criteria. The way you have defined it, you are using a single row of data as your criteria. This works as an AND operator, and it isn't working as you intend (>= / <=)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.