Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Updating Pivot-Tables

Hello everyone!
I have a very big doubt on how I can use Excel's Macro in
order to update automatically my pivot-table.
I already have a macro that "imports" the file when a
button is pressed. I am not being sucessful, however, in
updating the pivot table after importing the file.

It already looks like this:

Sub Import()
Application.ScreenUpdating = False
Application.EnableCancelKey = xlDisabled
arqAAbrir = Application.GetOpenFilename()

Workbooks.Open Filename:=arqAAbrir

NomeArquivo = ActiveWorkbook.Name

Range("A1:K9").Copy
Windows("Compilador_Visitas.xls").Activate
Dados.Visible = True
Dados.Select
Dados.Range("A" & Dados.Range("E1").Value).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Windows(NomeArquivo).Activate
Application.DisplayAlerts = False
ActiveWindow.Close

VisaoGeral.Select
Range("C4").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase,
SourceData:="Dados!R2C1:R" & Dados.Range("E1").Value - 1
& "C11"
Dados.Visible = False

Range("A1").Select
Application.ScreenUpdating = True

End Sub


Does anyone know how to do this???
Thanks in advance for your help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Updating Pivot-Tables

I use the following code:
ActiveSheet.PivotTables(name of the pivot table).PivotCache.Refresh
Hopefully it's of use to you. Good luck

Ruud

"Rafael Chang" schreef in bericht
...
Hello everyone!
I have a very big doubt on how I can use Excel's Macro in
order to update automatically my pivot-table.
I already have a macro that "imports" the file when a
button is pressed. I am not being sucessful, however, in
updating the pivot table after importing the file.

It already looks like this:

Sub Import()
Application.ScreenUpdating = False
Application.EnableCancelKey = xlDisabled
arqAAbrir = Application.GetOpenFilename()

Workbooks.Open Filename:=arqAAbrir

NomeArquivo = ActiveWorkbook.Name

Range("A1:K9").Copy
Windows("Compilador_Visitas.xls").Activate
Dados.Visible = True
Dados.Select
Dados.Range("A" & Dados.Range("E1").Value).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Windows(NomeArquivo).Activate
Application.DisplayAlerts = False
ActiveWindow.Close

VisaoGeral.Select
Range("C4").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase,
SourceData:="Dados!R2C1:R" & Dados.Range("E1").Value - 1
& "C11"
Dados.Visible = False

Range("A1").Select
Application.ScreenUpdating = True

End Sub


Does anyone know how to do this???
Thanks in advance 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
Updating Pivot Tables Ian Briffett Excel Discussion (Misc queries) 0 May 21st 08 08:18 PM
Updating all pivot tables at once rascal Excel Worksheet Functions 1 March 28th 07 01:44 AM
updating pivot tables ILoveAmerica!!! Excel Discussion (Misc queries) 0 October 11th 06 07:19 PM
updating pivot tables jgibbings Excel Discussion (Misc queries) 3 May 9th 05 11:02 PM
Updating Pivot Tables Steven Revell Excel Programming 6 August 26th 03 06:02 PM


All times are GMT +1. The time now is 02:16 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"