Whats wrong with this code?

juju

Board Regular
Joined
Mar 13, 2008
Messages
175
I use this code with a dropdown box on a spreadsheet to select months on a backend pivot table. it has worked great until I started to create a new dashboard - I just copied and pasted this code and changed the relevant fields: The name of the tab in the workbook with the data is "Summary", the pivot tables to change are "Message1" and "Message2", and the pivotfields being changed in both tables is the Month field... the error message is
"runtime error 1004: Application-defined or object-defined error"

Code:
Sub MessageMonthMacro()

Application.ScreenUpdating = False
'
' Internal dashboard month drop down box macro
'
    Sheets("Summary").PivotTables("Message1").PivotFields("Month").CurrentPage = Range("selMonth").Text
    Sheets("Summary").PivotTables("Message2").PivotFields("Month").CurrentPage = Range("selMonth").Text
    
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I use this code with a dropdown box on a spreadsheet to select months on a backend pivot table. it has worked great until I started to create a new dashboard - I just copied and pasted this code and changed the relevant fields: The name of the tab in the workbook with the data is "Summary", the pivot tables to change are "Message1" and "Message2", and the pivotfields being changed in both tables is the Month field... the error message is
"runtime error 1004: Application-defined or object-defined error"

Code:
Sub MessageMonthMacro()

Application.ScreenUpdating = False
'
' Internal dashboard month drop down box macro
'
    Sheets("Summary").PivotTables("Message1").PivotFields("Month").CurrentPage = Range("selMonth").Text
    Sheets("Summary").PivotTables("Message2").PivotFields("Month").CurrentPage = Range("selMonth").Text
    
Application.ScreenUpdating = True

End Sub


Anyone? - I'd really appreciate some help with this .... thx!
 
Upvote 0
Anyone? - I'd really appreciate some help with this .... thx!


I am working on a project which is due today and I cant figure this one out! I will appreciate any insight I can get .. thanks ..
 
Upvote 0

Forum statistics

Threads
1,215,050
Messages
6,122,868
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top