Michael151
Board Regular
- Joined
- Sep 20, 2010
- Messages
- 247
Hello all,
Wondering if anyone could help with the range function of using VBA to create a pivot table. The current range in the code below is "Raw Data!R1C1:R39000C33":
What I’d like to do is have the macro find the range itself based on a specific column. In my raw data, I’m using the column marked “deal_id” (row 1 header), to find the range. The last row of data based on this column is the last row used to make the pivot table. The macro would be something like this:
SourceData:=
“Raw Data!R1C1 and last row and C33
Last row = look in row 1 header, find “deal_id”, find last row with data in this column
Create Pivot Table with this range
Any help is most appreciated, thanks!
Wondering if anyone could help with the range function of using VBA to create a pivot table. The current range in the code below is "Raw Data!R1C1:R39000C33":
Code:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Raw Data!R1C1:R39000C33", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="", TableName:="PivotTable5", DefaultVersion _
:=xlPivotTableVersion12
What I’d like to do is have the macro find the range itself based on a specific column. In my raw data, I’m using the column marked “deal_id” (row 1 header), to find the range. The last row of data based on this column is the last row used to make the pivot table. The macro would be something like this:
SourceData:=
“Raw Data!R1C1 and last row and C33
Last row = look in row 1 header, find “deal_id”, find last row with data in this column
Create Pivot Table with this range
Any help is most appreciated, thanks!