cagirish81
New Member
Hi All,
Good Evening.. This is Girish from Mumbai, joined this worderful site few days back.. I have just started learning macros and vba..
Can anyone help me for following error?
I am creating pivot table in excel 2007 using vba. I want to set page field for pivot table. since I am a beginer I have recorded macro for the same but when I am running the macro it is showing Run time Error '1004' : Application-defined or object-defined error for the last line of the macro.
Following is my recorded macro :
[pre]
[/pre]
Plz help.
Many thnx in advance.
Good Evening.. This is Girish from Mumbai, joined this worderful site few days back.. I have just started learning macros and vba..
Can anyone help me for following error?
I am creating pivot table in excel 2007 using vba. I want to set page field for pivot table. since I am a beginer I have recorded macro for the same but when I am running the macro it is showing Run time Error '1004' : Application-defined or object-defined error for the last line of the macro.
Following is my recorded macro :
[pre]
Code:
Sub pivotfilter()
'
' pivotfilter Macro
'
'
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"EntryLevelDump!R5C1:R185442C31", Version:=xlPivotTableVersion12). _
CreatePivotTable TableDestination:="", TableName:="PivotTable3", _
DefaultVersion:=xlPivotTableVersion12
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable3").PivotFields("Month")
.Orientation = xlPageField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable3").PivotFields("Month").ClearAllFilters
ActiveSheet.PivotTables("PivotTable3").PivotFields("Month").CurrentPage = _
"31-05-2012"
End Sub
Plz help.
Many thnx in advance.