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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro in Excel - Run Time Error 1004

Status
Not open for further replies.

wandan

Technical User
Dec 16, 2001
101
US
Hello,

I am trying to run a very small macro in Excel97 that gets a value from a cell in one spreadsheet and uses that value to select the value in a pivot table in another sheet. I have used this same code many times and have had no problems with it, but now it is giving me a message "Run Time Error 1004: Unable to set the_Default property of PivotItem class".

Here is my code:

Sub update()
classCell = Worksheets("Class Report").Cells(1, 2)
Sheets("budget_pivot").Select
ActiveSheet.PivotTables("BudgetPivot").PivotFields("class").CurrentPage = classCell
Sheets("Class Report").Select
'ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWindow.SelectedSheets.PrintPreview
End Sub

Any thoughts will be greatly appreciated!

 
Nevermind -- I had an advanced sort on the field so it wouldn't let me update it. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top