#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
hshayh0rn
 
Posts: n/a
Default piviot table

I have a piviot table that I inherited and to be honest I'm not very Excel
savy just yet. I have a sheet within the workbook that I need to run a macro
on but when I run the macro the entire workbook recalculates each time a
value on this one sheet is changed and this worksheet could possibly have
1000+ cells that need to be changed. This causes a HUGE slowdown of this
macro. Here is the code that I "think" might be causing me the issue. I need
to somehow exclude this one worksheet from the automatic reclaulation that
the workbook is doing. I do not want to turn the auto-calculation for this
workoff off.

Sub ClearNoDataItems()
Dim pt As PivotTable
Dim PF As PivotField
Dim PI As PivotItem
Dim PItems As PivotItems
'Set pt = Selection.PivotTables(1)
For Each pt In ActiveSheet.PivotTables
pt.RefreshTable
For Each PF In pt.PivotFields
Set PItems = PF.PivotItems
For Each PI In PItems
If PI.RecordCount = 0 And PI.Name < "(blank)" Then
PI.Delete
Else
End If
Next PI
Next PF
Next pt
End Sub

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
hshayh0rn
 
Posts: n/a
Default piviot table

Please ignore this post. I figured out the code I need.

"hshayh0rn" wrote:

I have a piviot table that I inherited and to be honest I'm not very Excel
savy just yet. I have a sheet within the workbook that I need to run a macro
on but when I run the macro the entire workbook recalculates each time a
value on this one sheet is changed and this worksheet could possibly have
1000+ cells that need to be changed. This causes a HUGE slowdown of this
macro. Here is the code that I "think" might be causing me the issue. I need
to somehow exclude this one worksheet from the automatic reclaulation that
the workbook is doing. I do not want to turn the auto-calculation for this
workoff off.

Sub ClearNoDataItems()
Dim pt As PivotTable
Dim PF As PivotField
Dim PI As PivotItem
Dim PItems As PivotItems
'Set pt = Selection.PivotTables(1)
For Each pt In ActiveSheet.PivotTables
pt.RefreshTable
For Each PF In pt.PivotFields
Set PItems = PF.PivotItems
For Each PI In PItems
If PI.RecordCount = 0 And PI.Name < "(blank)" Then
PI.Delete
Else
End If
Next PI
Next PF
Next pt
End Sub

Any ideas?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Linking table in Excel to word travis Links and Linking in Excel 1 November 19th 05 02:30 PM
Piviot table help JOn K via OfficeKB.com Excel Discussion (Misc queries) 2 July 29th 05 05:36 PM
Change Data In Pivot Table John Calder New Users to Excel 1 July 7th 05 10:41 PM
Lookup Table Dilemma Karen Excel Worksheet Functions 2 June 10th 05 08:22 PM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"