Created
February 20, 2018 17:32
-
-
Save anonymous/0486f94a6c21ec1381a38053910cb0d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub ImportData_Test() 'Lấy dữ liệu từ 1 Workbook khác | |
| Dim owb As Workbook | |
| Dim sh As Worksheet | |
| Set sh=Sheet1 | |
| 'Mở file cần lấy dữ liệu | |
| Set owb=Workbooks.Open("C:\Test\England.xlsm") | |
| 'C:\Test\ là thư mục chứa file | |
| 'England.xlsm là tên file, dạng file | |
| 'Copy vùng dữ liệu cần lấy: Vùng A1:F100 trong Sheet Data của file cần lấy dữ liệu | |
| owb.Sheets("Data").Range("A1:F100").Copy | |
| 'Dán vào vị trí cần lấy kết quả: ô A1 trong Sheet1 của Workbook kết quả | |
| sh.Range("A1").PasteSpecial xlPasteValues | |
| 'Đóng file cần lấy dữ liệu | |
| owb.Close False | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment