Private Sub ComboBox1_Change()
Call
FILTER_FOR_TODATE
[C4].Formula = "=SUM(C6:C100)"
[D4].Formula
= "=SUM(D6:D100)"
[E4].Formula
= "=SUM(E6:E100)"
If
ComboBox1.Value = Range("C5").Value Then
TextBox3.Value
= Range("C4").Value
ElseIf
ComboBox1.Value = Range("D5").Value Then
TextBox3.Value
= Range("D4").Value
ElseIf
ComboBox1.Value = Range("E5").Value Then
TextBox3.Value
= Range("E4").Value
End If
End Sub
Private Sub TextBox1_Change()
Range("B3").Value
= TextBox1.Value
End Sub
Private Sub TextBox2_Change()
Range("B4").Value
= TextBox2.Value
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List
= Application.Transpose(ActiveSheet.Range("C5:E5").Value)
TextBox1.Value = Range("B3").Value
TextBox2.Value = Range("B4").Value
End Sub
PASTEKAN PADA MODUL
Sub FILTER_FOR_TODATE()
ActiveSheet.Range("A6:h200").Value
= ""
Sheets("data").Range("A7:E200").Copy
ActiveSheet.Cells(Cells.Rows.Count,
1).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
Dim row As
Long
LastRow =
ThisWorkbook.ActiveSheet.Cells(Rows.Count, 2).End(xlUp).row
row = 6
For row =
LastRow To row Step -1
If
Cells(row, 2).Value < Cells(3, 2).Value Then Cells(row, 2).EntireRow.Delete
If
Cells(row, 2).Value > Cells(4, 2).Value Then Cells(row, 2).EntireRow.Delete
Next row
End Sub
UNDUH CONTOH FILE >>> DISINI
No comments:
Post a Comment