ngocbinh.no.kia
Thành viên mới
- Tham gia
- 25/1/11
- Bài viết
- 42
- Được thích
- 2
Tôi có code như sau; nhờ anh em tạo giúp 1 vòng lặp. xin cảm ơn
Ghi chú: Range("PA_SXTM_B5") là mảng ô gồm 5 dòng và 22 cột, nhưng chỉ sử dụng dữ liệu ở các cột 1, 13, 18, và 22
Sub SAOLUUPA()
Dim arrB
Set arrB = Range("PA_SXTM_B5")
Sheets("BA").Cells(1, 1) = arrB(1, 1)
Sheets("BA").Cells(1, 2) = arrB(1, 13)
Sheets("BA").Cells(1, 3) = arrB(1, 18)
Sheets("BA").Cells(1, 4) = arrB(1, 22)
Sheets("BA").Cells(1, 5) = arrB(2, 1)
Sheets("BA").Cells(1, 6) = arrB(2, 13)
Sheets("BA").Cells(1, 7) = arrB(2, 18)
Sheets("BA").Cells(1, 7) = arrB(2, 22)
Sheets("BA").Cells(1, 8) = arrB(3, 1)
Sheets("BA").Cells(1, 9) = arrB(3, 13)
Sheets("BA").Cells(1, 10) = arrB(3, 18)
Sheets("BA").Cells(1, 11) = arrB(3, 22)
Sheets("BA").Cells(1, 12) = arrB(4, 1)
Sheets("BA").Cells(1, 13) = arrB(4, 13)
Sheets("BA").Cells(1, 14) = arrB(4, 18)
Sheets("BA").Cells(1, 15) = arrB(4, 22)
Sheets("BA").Cells(1, 16) = arrB(5, 1)
Sheets("BA").Cells(1, 17) = arrB(5, 13)
Sheets("BA").Cells(1, 18) = arrB(5, 18)
Sheets("BA").Cells(1, 19) = arrB(5, 22)
End Sub
Sub GOIPA()
Dim arrA(1 To 5, 1 To 22)
arrA(1, 1) = Sheets("BA").Cells(1, 1)
arrA(1, 13) = Sheets("BA").Cells(1, 2)
arrA(1, 18) = Sheets("BA").Cells(1, 3)
arrA(1, 22) = Sheets("BA").Cells(1, 4)
arrA(2, 1) = Sheets("BA").Cells(1, 5)
arrA(2, 13) = Sheets("BA").Cells(1, 6)
arrA(2, 18) = Sheets("BA").Cells(1, 7)
arrA(2, 22) = Sheets("BA").Cells(1, 7)
arrA(3, 1) = Sheets("BA").Cells(1, 8)
arrA(3, 13) = Sheets("BA").Cells(1, 9)
arrA(3, 18) = Sheets("BA").Cells(1, 10)
arrA(3, 22) = Sheets("BA").Cells(1, 11)
arrA(4, 1) = Sheets("BA").Cells(1, 12)
arrA(4, 13) = Sheets("BA").Cells(1, 13)
arrA(4, 18) = Sheets("BA").Cells(1, 14)
arrA(4, 22) = Sheets("BA").Cells(1, 15)
arrA(5, 1) = Sheets("BA").Cells(1, 16)
arrA(5, 13) = Sheets("BA").Cells(1, 17)
arrA(5, 18) = Sheets("BA").Cells(1, 18)
arrA(5, 22) = Sheets("BA").Cells(1, 19)
Range("PA_SXTM_B5") = arrA
End Sub
Ghi chú: Range("PA_SXTM_B5") là mảng ô gồm 5 dòng và 22 cột, nhưng chỉ sử dụng dữ liệu ở các cột 1, 13, 18, và 22
Sub SAOLUUPA()
Dim arrB
Set arrB = Range("PA_SXTM_B5")
Sheets("BA").Cells(1, 1) = arrB(1, 1)
Sheets("BA").Cells(1, 2) = arrB(1, 13)
Sheets("BA").Cells(1, 3) = arrB(1, 18)
Sheets("BA").Cells(1, 4) = arrB(1, 22)
Sheets("BA").Cells(1, 5) = arrB(2, 1)
Sheets("BA").Cells(1, 6) = arrB(2, 13)
Sheets("BA").Cells(1, 7) = arrB(2, 18)
Sheets("BA").Cells(1, 7) = arrB(2, 22)
Sheets("BA").Cells(1, 8) = arrB(3, 1)
Sheets("BA").Cells(1, 9) = arrB(3, 13)
Sheets("BA").Cells(1, 10) = arrB(3, 18)
Sheets("BA").Cells(1, 11) = arrB(3, 22)
Sheets("BA").Cells(1, 12) = arrB(4, 1)
Sheets("BA").Cells(1, 13) = arrB(4, 13)
Sheets("BA").Cells(1, 14) = arrB(4, 18)
Sheets("BA").Cells(1, 15) = arrB(4, 22)
Sheets("BA").Cells(1, 16) = arrB(5, 1)
Sheets("BA").Cells(1, 17) = arrB(5, 13)
Sheets("BA").Cells(1, 18) = arrB(5, 18)
Sheets("BA").Cells(1, 19) = arrB(5, 22)
End Sub
Sub GOIPA()
Dim arrA(1 To 5, 1 To 22)
arrA(1, 1) = Sheets("BA").Cells(1, 1)
arrA(1, 13) = Sheets("BA").Cells(1, 2)
arrA(1, 18) = Sheets("BA").Cells(1, 3)
arrA(1, 22) = Sheets("BA").Cells(1, 4)
arrA(2, 1) = Sheets("BA").Cells(1, 5)
arrA(2, 13) = Sheets("BA").Cells(1, 6)
arrA(2, 18) = Sheets("BA").Cells(1, 7)
arrA(2, 22) = Sheets("BA").Cells(1, 7)
arrA(3, 1) = Sheets("BA").Cells(1, 8)
arrA(3, 13) = Sheets("BA").Cells(1, 9)
arrA(3, 18) = Sheets("BA").Cells(1, 10)
arrA(3, 22) = Sheets("BA").Cells(1, 11)
arrA(4, 1) = Sheets("BA").Cells(1, 12)
arrA(4, 13) = Sheets("BA").Cells(1, 13)
arrA(4, 18) = Sheets("BA").Cells(1, 14)
arrA(4, 22) = Sheets("BA").Cells(1, 15)
arrA(5, 1) = Sheets("BA").Cells(1, 16)
arrA(5, 13) = Sheets("BA").Cells(1, 17)
arrA(5, 18) = Sheets("BA").Cells(1, 18)
arrA(5, 22) = Sheets("BA").Cells(1, 19)
Range("PA_SXTM_B5") = arrA
End Sub