'VBA to copy month wise data from Pivots from multiple workbooks
I have multiple pivot tables (month wise data in columns) in one worksheet and want to copy all tables in another workbook. I have defined the range to copy paste data but the problem is few Pivot table don't have all months (Jan-Dec), in few months are missing. How do I use match/index/hlookup function in vba to copy data based on month and paste in another workbook.
Book1.Sheets("Analysis").Range("A13:M71").Copy
Temp.Sheets("Data (2021)").Range("B4").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
:=True, Transpose:=False
Book2.Sheets("Analysis").Range("S17:W17").Copy
Temp.Sheets("Data (2021)").Range("Z21").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
:=True, Transpose:=False
Book3.Sheets("Analysis").Range("D12:H12").Copy
Temp.Sheets("Data (2021)").Range("Z36").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
:=True, Transpose:=False
Book4.Sheets("Analysis").Range("B5:J5").Copy
Temp.Sheets("Data (2021)").Range("X16").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
:=True, Transpose:=True
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
