Private Sub
Worksheet_Change(ByVal Target As Range)
If
Target.Address = [L1].Address Then
Call Filter_Tgl
End If
End Sub
Sub
Filter_Tanggal()
Dim TglAwal As Date
Dim i As Long,
Interval As Long
With
Sheets("Sheet2")
If .FilterMode Then
AutoFilter = False
TglAwal = Format(.Range("L1").Value, "dd/mm/yyyy")
Interval = (.Range("L2") - .Range("L1")) + 1
i
= TglAwal
.Range("B4").AutoFilter Field:=1, Criteria1:=">=" &
i, Operator:=xlAnd, Criteria2:="<" & i + Interval
End With
End Sub
Private
Sub ComboBox2_Change()
Worksheets("Sheet1").Range("B5:F112").Value
= ""
Worksheets("Sheet2").Cells(1,
12).Value = ComboBox1.Value
Worksheets("Sheet2").Cells(2,
12).Value = ComboBox2.Value
Worksheets("Sheet2").Cells(1,
12).Value = ComboBox1.Value
Worksheets("Sheet2").Cells(2,
12).Value = ComboBox2.Value
Worksheets("Sheet2").Range("B5:F112").SpecialCells(xlCellTypeVisible).COPY
Sheets("Sheet1").Select
Range("B5").Select
'lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row
'
Range("A" & lMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
TextBox1.Value = Worksheets("Sheet1").Cells(2, 6).Value
TextBox1.Value = Format(TextBox1.Value, "Rp #,##0")
Sheets("Sheet2").Select
ListBox1.ColumnCount
= 6
ListBox1.ColumnWidths
= 19 & ";" & 60 & ";" & 80 &
";" & 15 & ";" & 40 & ";" & 50
ListBox1.RowSource =
"data1"
End Sub
Private
Sub UserForm_Initialize()
ComboBox1.List =
Sheets("Sheet2").Range("B5:B50").Value
ComboBox2.List =
Sheets("Sheet2").Range("B5:B50").Value
End Sub
Demikian silahkan dikembangkan semoga bermanfaat !!
No comments:
Post a Comment