Home > Excel Tutorial > Filtering Based On Dates

Filtering Based On Dates

The Products Filtering Based On Dates -First And Last Date –

In this template ago,the products  are filled  with unique items into combobox and sorted alfabetically .Following codes were used:

Private Sub UserForm_Initialize()
Dim ComBoList      As Variant, LastRow&, cell As Range
Dim ComBoTemp       As Variant, x, j     As Long
 
Application.ScreenUpdating = False
 
With Worksheets(“Sayfa1”)
On Error Resume Next
.ShowAllData
Err.Clear
LastRow = .Cells(Rows.Count, 3).End(xlUp).Row
.Range(“C2:C” & LastRow).AdvancedFilter Action:=xlFilterInPlace, Unique:=True
ComboBox1.Clear
For Each cell In .Range(“C2:C” & LastRow).SpecialCells(12)
ComboBox1.AddItem cell.Value
Next cell
On Error Resume Next
.ShowAllData
Err.Clear
End With
 
ComBoList = Me.ComboBox1.List
 
For x = LBound(ComBoList) To UBound(ComBoList) – 1
For j = x + 1 To UBound(ComBoList)
If ComBoList(x, 0) > ComBoList(j, 0) Then
ComBoTemp = ComBoList(x, 0)
ComBoList(x, 0) = ComBoList(j, 0)
ComBoList(j, 0) = ComBoTemp
End If
Next j
Next x
End Sub

         If the dates (first date,last date) are entered in text boxes and if report button is pressed  the userform elongation effect is activated and listbox appears. Products can be filtered on listbox.

Visit Here To Download It

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: