Code copy nhiều sheet về 1 sheet không theo thứ tự các cột (1 người xem)

Người dùng đang xem chủ đề này

kydang1989

Thành viên chính thức
Tham gia
17/10/14
Bài viết
63
Được thích
3
Xin chào các a/c GPE
mình có 1 sheet tổng và nhiều sheet con.
mình muốn copy các sheet con về cùng 1 sheet không theo thứ tự các cột
( các sheet con có cùng cấu trúc như nhau)

trong file đính kèm có chú thích rõ hơn
và cho mình hỏi 1 vấn đề hơi ngoài lề: là cái sheet "tonghop" cty đưa mình làm cách nào định dạng mà không thấy số 0, mặc dù nó có số 0 ? (nghĩa là khi copy số 0 vào sheet tonghop thì ta không thấy số 0 nhưng nó có số 0 ?)
 

File đính kèm

mình có sưu tầm được đoạn code này, sửa lại theo bài của mình,

Mã:
[COLOR=#000000][FONT=Consolas]Sub Copy()[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]   Dim i As Long, ShArr[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]   ShArr = Array("DA_GTSX", "TV_TTQA", "TV_TTSX", "MP_GTQA")[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]   For i = 0 To 3[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[F65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[x2:x1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[C65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[z2:z1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[M65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[ae2:ae1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[N65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[AF2:[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]AF[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[O65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[AC2:AC1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[P65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[AD2:AD1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]      Sheets("tonghop").[Q65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]AA[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]2:[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]AA[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]       Sheets("tonghop").[S65000].End(xlUp).Offset(1).Resize(1000).Value = Sheets(ShArr(i)).[AB2:AB1001].Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]   Next[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]End Sub[/FONT][/COLOR]
nhưng còn vấn đề bỏ đi những dòng có chuyền "X" và "#N/A"( Còn lại copy hết) thì không biết chèn thêm code gì vào để không copy chuyền "X" và "#/N/A" ??? các bạn giúp mình.
 
Lần chỉnh sửa cuối:
Upvote 0

Bài viết mới nhất

Back
Top Bottom