ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003 file gets 25% bigger after changing TP source with VBA (https://www.excelbanter.com/excel-programming/447261-excel-2003-file-gets-25%25-bigger-after-changing-tp-source-vba.html)

Bobby[_4_]

Excel 2003 file gets 25% bigger after changing TP source with VBA
 
Could someone tell me why is the file is getting bigger?

This is my code:

Sub test()

Dim pt As PivotTable
Dim ws As Worksheet
tmp = ""
tmp1 = ""

Application.EnableEvents = False
Application.DisplayAlerts = False
Application.EnableEvents = False

For Each ws In ActiveWorkbook.Worksheets
Range("C12").Select
For Each pt In ws.PivotTables
tmp = pt.SourceData
tmp1 = Replace(tmp, "2011-2012", "2012-2013")
'MsgBox ws.Name
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:=tmp1

ActiveWorkbook.ShowPivotTableFieldList = False
Application.CommandBars("PivotTable").Visible = False

tmp = ""
tmp1 = ""
Sheets(ws.Name).Select

Next pt
Next ws
Application.Calculation = xlAutomatic
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub


All times are GMT +1. The time now is 09:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com