PivotTable Formating woes. Potential Work-Around

Pete_Bristol

Board Regular
Joined
Mar 8, 2006
Messages
122
Dear All,

Please can you help with the following problem.

The fact that pivottables do not keep their custom formatting after refresh (despite setting properties of preserveformating etc) is an age-old problem which can be "solved" by running a user macro to reformat, associated with the PivotTableUpdate event. No problem with any of that and have been doing it successfully for years.

My current project has a single external sql query which is linked to about 10 pivottables, each on their own tab (which are initially hidden) and are "beautifully" format with subtotals, complex conditional formatting etc...the works!

The problem starts when the query, and hence the pivottables, are refreshed as this destroys all the formating. Although the pivottable update event fires, the reformatting macro does not work because it depends heavily on "pivotselect" and the tabs are hidden.

I have tried every possible solution I can think of to overcome this problem, from millions of application.screenupdating=false to Win32 API to lock and freeze the window whilst each tab is unhidden and reformat but nothing, and I mean NOTHING seems to work. The screen just dances all over the place as the macro does its stuff.

The best I can come up with is to attached my re-format macro to the worksheet_activate event so at least it gets reformat when the tab is selected but this is still "messy" as the user gets to see it update infront of their eyes!

All i want to acheive is
1. update external query (OK),
2. refresh pivottables on hidden tabs (OK),
3. reformat each so that they look professional *before* they are chosen (NOT OK)

In normal VBA there is generally never a reason to "select" before carrying out an operation but I cant seem to find any easy and quick alternative to using pivotselect.

I've struggling with this for days now and have searched the net high and low without sucess. This must be a common problem, am I overlooking something obvious?

I look forward to any replies I receive.

Thank you

Pete
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hard to say specifically without knowing what you are using pivotselect for, but it should be possible to avoid it.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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