View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default pivot table questions


1)
Sub test()
Dim pt As PivotTable
Dim txt As String

txt = "6"

Set pt = Sheet2.PivotTables(1)
pt.SourceData = "Sheet2!R1C2:R" & txt & "C4"
pt.RefreshTable
End Sub


2)
pt.TableRange2.Clear



"Gary Keramidas" wrote:

1. any way to use the A1 notation instead of r1c1?
i'd rather use "b3:g68" than this:
"Sheet1!R3C2:R" & Lastrow & "C7") , but can't seem to get it to work.

2. it doesn't appear you can run code to overwrite a pivot table. what do
experienced programmers do? i can delete the whole sheet before i run the
code again, but what's the best practice? the number of lines in the other
sheet will constantly change, so the range needs to be updated.
or
3. is there way to just update the range of data with performing the
complete pivot table creation again?

--


Gary