R
Rafael Chang
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.
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.