Code VBA cập nhật dữ liệu
Em chào mọi người!!!!!
Em có flie Excel như đính kèm, em mong muốn được giúp đỡ code VBA để có thể cập nhật dữ liệu từ sheet Xuat_T5 qua sheet XK_ngay . Thứ tự ngày được sắp xếp tăng dần ạ
Em cảm ơn cả nhà ạ !!!!!
Đây bạn chạy thử, mình mù mảng
Sub GPE()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim r As Integer
Dim c As Integer
Dim orr As Integer
Dim orc As Integer
Dim dt As Worksheet
Dim rp As Worksheet
Set dt = Sheets("Xuat_T5")
Set rp = Sheets("XK_ngay")
orr = 7
orc = 6
For c = orc To 31 + orc
For r = orr To WorksheetFunction.CountA(dt.Range("A1:A9999")) + orr
lr = rp.Cells(Rows.Count, "D").End(xlUp).Row + 1
If dt.Cells(r, c) > 0 Then
rp.Cells(lr, 1) = dt.Cells(orr - 1, c)
rp.Cells(lr, 4) = dt.Cells(r, 2)
rp.Cells(lr, 5) = dt.Cells(r, 3)
rp.Cells(lr, 6) = dt.Cells(r, 4)
rp.Cells(lr, 8) = dt.Cells(r, c)
End If
Next r
Next c
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
www.giaiphapexcel.com/diendan/threads/code-vba-c%E1%BA%ADp-nh%E1%BA%ADt-d%E1%BB%AF-li%E1%BB%87u.165210/
Khóa học SprinGO phù hợp
Khóa học Power PI – Ứng dung trong Nhân sự
TỔNG QUAN KHÓA HỌC: POWER BI CHO NGÀNH NHÂN SỰ Khóa học Power BI cho Nhân sự được thiết kế dành riêng cho các...
Xem khóa học
Bình luận