Private Sub CommandButton1_Click()
Dim ara As Range, LastRow As Long
Dim tarih1, tarih2 As Date
Dim s1 As Worksheet
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
Set s1 = Worksheets("filtered")
If TextBox1.Value = "" Or TextBox2.Value = "" Then
MsgBox "You need to add the beginning and end dates", vbCritical, ""
Exit Sub
End If
If ComboBox1.Value = "" Then
MsgBox "Please choose a product from drop-down list", vbDefaultButton1, ""
Exit Sub
End If
Call uzat
tarih1 = CDate(TextBox1.Value)
tarih2 = CDate(TextBox2.Value)
ListBox1.Clear
ListBox1.ColumnCount = 8
ListBox1.ColumnWidths = "100;70;50;50;50;50;50;50"
LastRow = s1.Range("G" & Rows.Count).End(xlUp).Row
For Each ara In s1.Range("g18:g" & LastRow)
If CLng(CDate(ara.Value)) >= CLng(CDate(tarih1)) And _
CLng(CDate(ara.Value)) <= CLng(CDate(tarih2)) And _
CStr(ara.Offset(0, -6).Value) = CStr(ComboBox1.Text) Then
ListBox1.AddItem ara.Offset(0, -6)
ListBox1.List(ListBox1.ListCount - 1, 1) = ara.Offset(0, -5)
ListBox1.List(ListBox1.ListCount - 1, 2) = ara.Offset(0, -4)
ListBox1.List(ListBox1.ListCount - 1, 3) = Format(ara.Offset(0, -3), "#,##0.00")
ListBox1.List(ListBox1.ListCount - 1, 4) = Format(ara.Offset(0, -2), "#,##0.00")
ListBox1.List(ListBox1.ListCount - 1, 5) = Format(ara.Offset(0, -1), "#,##0.00")
ListBox1.List(ListBox1.ListCount - 1, 6) = VBA.Format(ara, "dd.mm.yyyy")
ListBox1.List(ListBox1.ListCount - 1, 7) = ara.Offset(0, 1)
End If
Next ara
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub