Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I Make a Monthly Pivot Table, with data blocks of Varying Size

Status
Not open for further replies.

pyromaniac

Programmer
Mar 19, 2003
6
GB
I need to create a pivot table of the average mileage that an employee has travelled, the problem is the size of the data block varies, from month to month eg.january is 25 cells with data in from column 'A' to 'L', and february is 100 cells down with data in from column 'A' to 'L'. How can i write a macro that selects only the required data, so as it can be put into a pivot table?
 
you could pick the Rows & Columns from ActiveSheet.UsedRange "Whereever you go there are people who need you for what you can do..."
 
Or

Range("A1").Select
Selection.End(xlDown).Select
mLstRow = ActiveCell.Row

ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
ActiveSheet.Name & "!R1C1:R" & mLstRow & "C26", TableDestination:="", TableName:="PivotTable1"

"C26" as use upto "Z" Column
"Whereever you go there are people who need you for what you can do..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top