



Chạy code nàyNhờ các anh chị giúp em tách 1 cột gồm nhiều ngày ra thành nhiều cột, mỗi cột tương ứng 1 ngày
Trân trọng cảm ơn
Sub tach()
Dim data(), i
[G6:AK1000].Clear
data = Range([A6], [B65536].End(3)).Value
For i = 1 To UBound(data)
If data(i, 1) > 0 Then
Cells(65536, data(i, 1) + 6).End(3)(2) = data(i, 2)
End If
Next
End Sub
Option Explicit
Sub TachTheoCot()
Dim Cls As Range
Sheet1.Select
[g6].CurrentRegion.Offset(1).ClearContents
Application.ScreenUpdating = False
For Each Cls In Range([b6], [b6].End(xlDown))
Cells(Rows.Count, 6 + Cls.Offset(, -1)).End(xlUp).Offset(1).Value = Cls.Value
Next Cls
Application.ScreenUpdating = True
End Sub
Thêm một lựa chọn dùng công thức.Nhờ các anh chị giúp em tách 1 cột gồm nhiều ngày ra thành nhiều cột, mỗi cột tương ứng 1 ngày
Trân trọng cảm ơn
G6=IFERROR(VLOOKUP(G$5,OFFSET($A$5:$B$5,MATCH(G$5,$A$6:$A$1641,0)+ROW($A1)-1,),2,0),"")