namhandsome1
Thành viên mới

- Tham gia
- 11/9/16
- Bài viết
- 38
- Được thích
- 5
Sub lap()
Dim a, b, c As Long
Dim endrow As Long
Dim kq1()
endrow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
arr2 = Sheet2.Range("A1:O" & endrow).Value
For c = 1 To 14
ReDim kq1(1 To UBound(arr2, 1) - c, 1 To UBound(arr2, 2) - c)
For a = 1 To (UBound(arr2, 1) - 1)
For b = 2 To UBound(arr2, 2)
If arr2(a, b) <> "" Then
kq1(a, b) = arr2(a, b) 'Báo lỗi Subcript out of range tại dòng này
End If
Next b
Next a
Sheet2.Range("A" & (c * 17)).Resize(UBound(arr2, 1) - c, UBound(arr2, 2) - c) = kq1
Next c
End Sub
Dim a, b, c As Long
Dim endrow As Long
Dim kq1()
endrow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
arr2 = Sheet2.Range("A1:O" & endrow).Value
For c = 1 To 14
ReDim kq1(1 To UBound(arr2, 1) - c, 1 To UBound(arr2, 2) - c)
For a = 1 To (UBound(arr2, 1) - 1)
For b = 2 To UBound(arr2, 2)
If arr2(a, b) <> "" Then
kq1(a, b) = arr2(a, b) 'Báo lỗi Subcript out of range tại dòng này
End If
Next b
Next a
Sheet2.Range("A" & (c * 17)).Resize(UBound(arr2, 1) - c, UBound(arr2, 2) - c) = kq1
Next c
End Sub