Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
' Assuming your data starts in column A, with headers in row 1
' and the column has no blanks ' Once the file is open Sheet_Name = ActiveSheet.Name Last_Row = ActiveSheet.Range("A65536").End(xlUp).Row Your_Last_Column = 10 ' amaned this to the column number of your last column Pivot_Name = "YOUR PIVOT TABLE NAME" Source_Range = "'" + Sheet_Name + "'!R1C1:R" + CStr(Last_Row) + "C" + CStr(Your_Last_Column) ' ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ Source_Range).CreatePivotTable TableDestination:= _ "", TableName:=Pivot_Name, DefaultVersion:=xlPivotTableVersion10 I am assuming that you've got the rest of the pivot routine and it's just the range that's an issue. "Jodie" wrote: I am trying to write a macro to create a pivot table to use in multiple files where each file will contain the same headers and number of columns. However, the number of rows will vary in each file. Each file has one sheet and all of these sheets have a different name. Can anyone please help? -- Thank you, Jodie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I detail Pivot Table data without creating a table (Excel2007) | Excel Discussion (Misc queries) | |||
How can I detail Pivot Table data without creating a table (Excel2007) | Excel Discussion (Misc queries) | |||
creating a report from a table, pivot table not suitable | Excel Worksheet Functions | |||
creating a pivot table from 4 pivot tables | Excel Worksheet Functions | |||
Creating Pivot Table with VBA | Excel Programming |