Thứ Sáu, 8 tháng 1, 2021

Share VBA Sub Sort tự động sắp xếp sổ sách kế toán theo ngày chứng từ

Sub SAPXEP_NGAYCHUNGTU()
On Error Resume Next
Dim SH1 As Worksheet
Set SH1 = Sheets("SONHATKYCHUNG")
SH1.Range("I" & HSDONGDAU - 1 & ":" & "I" & HSDONGCUOI).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
dk.Range("DK1_DK"), Unique:=False
SH1.ShowAllData
SH1.Range("J" & HSDONGDAU + 1).Formula = "=RC[-7]&RC[-8]"
SH1.Range("J" & HSDONGDAU + 1).Copy
SH1.Range("J" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1).Select
ActiveSheet.Paste
'COPY DU LIEU HOAN THANH
SH1.Range("A" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1).Copy
SH1.Range("A" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1).Select
'Dan dac biet - dan so lieu (ko copy cong thuc dinh dang)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' SAP XEP LAI DU LIEU
SH1.Range("A" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1).Select
sudungham = _
f_sx1c_A(SH1.Range("A" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1), _
SH1.Range("J" & HSDONGDAU + 1 & ":" & "J" & HSDONGCUOI - 1))
'TRICH LOC
SH1.Range("i" & HSDONGDAU - 1 & ":" & "IV" & HSDONGCUOI).Select
Selection.AutoFilter Field:=1, Criteria1:="1"
End Sub
Previous Post
Next Post

0 nhận xét: