Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created February 21, 2018 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuongAQ/e74989fe4fbad8b386505e3f81b6911d to your computer and use it in GitHub Desktop.
Save DuongAQ/e74989fe4fbad8b386505e3f81b6911d to your computer and use it in GitHub Desktop.
Sub ExportData_Test() 'Trích xuất dữ liệu vào Workbook khác
Dim owb As Workbook
Dim sh As Worksheet
'Xác định vùng dữ liệu cần trích xuất
Set sh=Sheet1
sh.Range("A1:F100").Copy
'Mở Workbook cần lấy dữ liệu
Set owb=Workbooks.Open("C:\Test\England.xlsm")
'Dán nội dung cần trích xuất vào workbook vừa được mở
owb.Sheets("Data").Range("A1").PasteSpecial xlPasteValues
'Đóng Workbook cần lấy dữ liệu, lưu ý là có Save khi đóng
owb.Close True
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment