First post ever.
I have a macro (Excel 2003) which refreshes a number of pivot tables based on values in three different cells on a separate worksheet. The macro runs fine when fired independently.
I added a dropdown list to select values for each of these cells and triggered the firing of my macro using a worksheet change event. This works perfectly.
What I really want is to use three combo boxes to select the values and to trigger the macro using a combobox change event. When I try this, however the macro bombs on the third line of code. I'm pretty new to VBA and I've never tried to use the combobox change event so I may be missing something really basic.
Here's the code I'm using for the change event. (The macro name is "RefreshPivots"). I've placed the following code on the worksheet object (within the VBA editor) for the worksheet where the combo box was placed. Again the macro runs perfectly when I run it on its own which leads me to suspect that there's something wrong with my combox change event code.
Here's a snippet of the macro code which refreshes the first of several pivot tables:![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
The line of code (executable line3) where the macro fails is:
The error is:![]()
Please Login or Register to view this content.
Run-time error '1004'
Unable to get the PivotFields property of the PivotTable class
Thanks for any help you can offer
Bookmarks