Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Auto Refresh/Format a PivoTable

I have this code in a module, so as to refresh automatically a pivot table
in a sheet named "PrintSheet" it works fine in till I added some extra code
to format the cell D:D. What happens is now it tries to format every sheet I
go into, I only what to format every time I click on the "PrintSheet" and
not in all the other sheets, and also need it to format from range D6:D not
the complete column.
I found out that the pivot table does not keep its format properties, so
when new data is added it need to be formatted everytime, that is why I like
to do this auto refresh/format.

Sub Auto_Open()
Application.OnSheetActivate = "UpdateIt"
End Sub
Sub UpdateIt()
Dim iP As Integer
Application.DisplayAlerts = False
For iP = 1 To ActiveSheet.PivotTables.Count
ActiveSheet.PivotTables(iP).RefreshTable
Next
Application.DisplayAlerts = True

'Added Code to format D6:D
Columns("D:D").Select
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Range("D2").Select
Selection.Locked = False
Selection.FormulaHidden = False
End Sub


Thanks for your help!


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
Auto Refresh George Excel Discussion (Misc queries) 3 September 18th 09 04:33 PM
Copy Excel functions formula and auto refresh refresh Pauline Cheong Excel Worksheet Functions 3 February 16th 09 01:23 AM
How can I auto refresh a column that has an auto filter in place Pastal Excel Discussion (Misc queries) 1 December 18th 07 11:43 AM
Auto Refresh RobGTP Excel Discussion (Misc queries) 0 September 29th 07 06:21 AM
How can I auto-refresh auto-filters when data changes? Mike@MPWco Excel Worksheet Functions 0 July 4th 06 12:50 PM


All times are GMT +1. The time now is 02:19 AM.

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

About Us

"It's about Microsoft Excel"