View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Where to input a SUB function?

Hi,

Alt+f11 to open Vb editor. Right click 'this workbook' and insert module.
Paste the code in on the right.

Mike

"NightLord" wrote:

I found a site that shows some code for removing old entries in a PivotTable.
However, it does NOT say where to put the damn code. It's a SUB function.

Here is the code:
Sub DeleteMissingItems2002All()
'prevents unused items in non-OLAP PivotTables

Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache

'change the settings
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
Next pt
Next ws

'refresh all the pivot caches
For Each pc In ActiveWorkbook.PivotCaches
On Error Resume Next
pc.Refresh
Next pc

End Sub


So, where do I input it??