Hide the row inside the textbox if there is a zero in the second and fourth column
Private Sub ComboBox1_Change()
Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "yyyy/mm/dd")
End Sub
Private Sub ComboBox3_Change()
Me.ComboBox3.Value = Format(Me.ComboBox3.Value, "yyyy/mm/dd")
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
Dim v As Integer, lr, i
ListBox1.Clear
lr = Sheets("DATA").Cells(Sheets("DATA").Rows.Count, "A").End(xlUp).Row
For i = 2 To lr
If Sheets("DATA").Cells(i, 1).Offset(0, 0) >= CDate(ComboBox1.Text) Then
If Sheets("DATA").Cells(i, 1).Offset(0, 1) = ComboBox2.Text Then
If Sheets("DATA").Cells(i, 1).Offset(0, 0) <= CDate(ComboBox3.Text) Then
ListBox1.AddItem Sheets("DATA").Cells(i, 1).Value
ListBox1.List(v, 1) = Format(Sheets("DATA").Cells(i, 0).Offset(0, 0).Value, "YYYY/MM/DD")
ListBox1.List(v, 2) = Sheets("DATA").Cells(i, 1).Offset(0, 1).Value
ListBox1.List(v, 3) = Sheets("DATA").Cells(i, 1).Offset(0, 2).Value
ListBox1.List(v, 5) = Sheets("DATA").Cells(i, 1).Offset(0, 4).Value
v = v + 1
End If
End If
End If
Next
End Sub
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 7
End Sub
[/CODE]
Private Sub ComboBox1_Change()
Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "yyyy/mm/dd")
End Sub
Private Sub ComboBox3_Change()
Me.ComboBox3.Value = Format(Me.ComboBox3.Value, "yyyy/mm/dd")
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
Dim v As Integer, lr, i
ListBox1.Clear
lr = Sheets("DATA").Cells(Sheets("DATA").Rows.Count, "A").End(xlUp).Row
For i = 2 To lr
If Sheets("DATA").Cells(i, 1).Offset(0, 0) >= CDate(ComboBox1.Text) Then
If Sheets("DATA").Cells(i, 1).Offset(0, 1) = ComboBox2.Text Then
If Sheets("DATA").Cells(i, 1).Offset(0, 0) <= CDate(ComboBox3.Text) Then
ListBox1.AddItem Sheets("DATA").Cells(i, 1).Value
ListBox1.List(v, 1) = Format(Sheets("DATA").Cells(i, 0).Offset(0, 0).Value, "YYYY/MM/DD")
ListBox1.List(v, 2) = Sheets("DATA").Cells(i, 1).Offset(0, 1).Value
ListBox1.List(v, 3) = Sheets("DATA").Cells(i, 1).Offset(0, 2).Value
ListBox1.List(v, 5) = Sheets("DATA").Cells(i, 1).Offset(0, 4).Value
v = v + 1
End If
End If
End If
Next
End Sub
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 7
End Sub
[/CODE]