I made macro to make a pivot table.
The problem is: everytime I load the data that are some times the row
and the coloumn are not the same, sometimes more simetimes less. But the
field that I coose is always there
Question: how to create the command to select the datas up to the last
coloumn and last row?
Sub PM01_Pivot()
'
' PM01_Pivot Macro
' Macro recorded 2/14/2005 by wayan
'
'
ActiveWindow.SmallScroll ToRight:=-3
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=
_
"Sheet1!R1C1:R2374C12").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3,
1)
ActiveSheet.Cells(3, 1).Select
With
ActiveSheet.PivotTables("PivotTable1").PivotFields("FunctLocation")
.Orientation = xlRowField
.Position = 1
End With
Range("A4").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("FunctLocation").
_
Orientation = xlHidden
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Main
WorkCtr")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("User
status")
.Orientation = xlColumnField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField
ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Order"), "Count of Order", xlCount
End Sub