Chào các anh GPE
Công việc như sau
Mở file copysheet lên nhấn nút copy 3 thì chép tất cả các dữ liệu từ file kế hoạch
sang sheetcopy
hiện tại mình làm được copy2 chỉ copy được 1 sheet thoi
nay muốn mở rộng thêm nhưng không biết sai chỗ nào
]
Công việc như sau
Mở file copysheet lên nhấn nút copy 3 thì chép tất cả các dữ liệu từ file kế hoạch
sang sheetcopy
hiện tại mình làm được copy2 chỉ copy được 1 sheet thoi
nay muốn mở rộng thêm nhưng không biết sai chỗ nào
Mã:
Private Sub CommandButton3_Click()
Dim wb As Workbook, sh As Worksheet, WBname As String
Dim cursh As Worksheet, chk As Boolean
With Application.FileDialog(1)
.InitialFileName = ThisWorkbook.Path
.Title = "Chon file nguon"
.FilterIndex = 3
.AllowMultiSelect = False
Do
.Show
If .SelectedItems.Count = 0 Then Exit Sub
If .SelectedItems(1) = ThisWorkbook.FullName Then MsgBox "Khong chon file nay!"
Loop Until .SelectedItems(1) <> ThisWorkbook.FullName
Application.DisplayAlerts = False
ThisWorkbook.Sheets(1).Cells.ClearContents
With Workbooks.Open(.SelectedItems(1))
For Each sh In .Worksheets
.sh.Range(sh.[A3], sh.[H6000].End(xlUp)).Copy
ThisWorkbook.Sheets(1).[A6000].End(xlUp)(2).PasteSpecial Paste:=xlPasteValues
Next
.Close False
End With
Application.DisplayAlerts = True
End With
End Sub
Lần chỉnh sửa cuối:


