Pivot Macro

R

Ranjit kurian

Hi,

I have two sheets in excel,

sheet1 is the source data, where the count of the data keep changes.
sheet2 is the pivot sheet, where pivot is allready created.

I need a excel macro code, to update my pivot every day, when i run macro.
Update means, As in sheet1 the count of row keep changing the macro first it
should check the count in sheet1 then, the macro should update the same row
count in pivot.
Macro should do the changes in existing pivot, it should not create a new
pivot.

Please help me...
 
R

Roger Govier

Hi

Instead of using a fixed range as the source for your PT, use a Dynamic
range.
Insert>Name>Define>Name myData Refers to =
Sheet1!$A$1:INDEX(Sheet1!$1:$65536,COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$1:$1))

Then refer to the named range myData in your macro
 
V

Vishwanath N

Try the code below
copy and Paste the code in new module

Option Explicit

Sub ShowDates()
Dim pt As PivotTable
Dim ws As Worksheet
Set ws = Worksheets("Pivot")
Set pt = ws.PivotTables(1)

pt.PivotCache.Refresh
End Sub


Vishwanath N
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top