Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Creating a Pivot table

' 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I detail Pivot Table data without creating a table (Excel2007) Skeletiko[_2_] Excel Discussion (Misc queries) 1 May 5th 10 08:22 AM
How can I detail Pivot Table data without creating a table (Excel2007) Skeletiko Excel Discussion (Misc queries) 0 May 5th 10 12:21 AM
creating a report from a table, pivot table not suitable UKMAN Excel Worksheet Functions 1 April 16th 10 08:35 AM
creating a pivot table from 4 pivot tables phyllis W Excel Worksheet Functions 0 October 12th 08 09:52 PM
Creating Pivot Table with VBA Eric Lecocq Excel Programming 2 December 11th 03 01:53 PM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"