1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Sub MOMO()
Dim Item As ListItem
Dim L As Integer
Dim i As Integer
TextBox3.Visible = True
TextBox4.Visible = True
TextBox5.Visible = True
TextBox6.Visible = True
TextBox7.Visible = True
TextBox8.Visible = True
ListView1.Visible = True
ListView1.Top = 120
ListView1.ListItems.Clear
Set SS = Worksheets("HIST")
L = SS.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To L
If SS.Cells(i, 1) >= CDate(TextBox1) And SS.Cells(i, 1) <= CDate(TextBox2) Then
If CheckBox1.Value = True Then
Set Item = ListView1.ListItems.Add(Text:=SS.Cells(i, 1))
Item.SubItems(1) = Format(SS.Cells(i, 2), "# ##0")
Item.SubItems(2) = Format(SS.Cells(i, 3), "# ##0")
Item.SubItems(3) = Format(SS.Cells(i, 4), "# ##0")
Item.SubItems(4) = Format(SS.Cells(i, 5), "# ##0")
Item.SubItems(5) = Format(SS.Cells(i, 6), "# ##0")
Item.SubItems(6) = Format(SS.Cells(i, 15), "# ##0")
Item.SubItems(7) = Format(SS.Cells(i, 16), "# ##0")
Item.SubItems(8) = i
Else
If CheckBox2.Value = True And SS.Cells(i, 2) = ComboBox1.Value Then
Set Item = ListView1.ListItems.Add(Text:=SS.Cells(i, 1))
Item.SubItems(1) = Format(SS.Cells(i, 2), "# ##0")
Item.SubItems(2) = Format(SS.Cells(i, 3), "# ##0")
Item.SubItems(3) = Format(SS.Cells(i, 4), "# ##0")
Item.SubItems(4) = Format(SS.Cells(i, 5), "# ##0")
Item.SubItems(5) = Format(SS.Cells(i, 6), "# ##0")
Item.SubItems(6) = Format(SS.Cells(i, 15), "# ##0")
Item.SubItems(7) = Format(SS.Cells(i, 16), "# ##0")
Item.SubItems(8) = i
End If
End If
End If
Next
End Sub |