thutran0801
Thành viên chính thức


- Tham gia
- 19/8/16
- Bài viết
- 61
- Được thích
- 1
Chào mọi người, mình có file để tạo pivot tự động dùng code macro nhưng có chỗ mình ko biết phải chỉnh sửa như thế nào mong mọi người giúp đỡ.!
Workbooks.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"[Test(1).xlsx]Data!R1C1:R36C10", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Sheet1!R1C1", TableName:="PivotTable1" _
, DefaultVersion:=xlPivotTableVersion14
Sheets("Sheet1").Select
Cells(1, 1).Select
Chỗ tên file người bôi đỏ có cách nào để động không tức là lấy tên file từ chỗ chọn file như hình của file code, vì dùng code macro chỗ đó bị cố định như vậy mình không biết phải sữa như thế nào

Workbooks.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"[Test(1).xlsx]Data!R1C1:R36C10", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Sheet1!R1C1", TableName:="PivotTable1" _
, DefaultVersion:=xlPivotTableVersion14
Sheets("Sheet1").Select
Cells(1, 1).Select
Chỗ tên file người bôi đỏ có cách nào để động không tức là lấy tên file từ chỗ chọn file như hình của file code, vì dùng code macro chỗ đó bị cố định như vậy mình không biết phải sữa như thế nào
