View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Pivot Table - Code Optimization

dim mySource as range
set mysource = sheet1.usedrange

...., _
SourceData:=mySource.address(external:=true), ...
...

But I'd be a little careful with that .usedrange. Excel keeps track of the
usedrange a lot closer than you do (I bet). Try hitting ctrl-end and see where
it takes you.

But if you want to use C3:U (lastrow of column C), you could do this:

with sheet1
set mysource = .range("c3:u" & .cells(.rows.count,"C").end(xlup).row)
end with





"kaon <" wrote:

one more question:

Q1:

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase,
SourceData:="Sheet1!R3C3:R261C21" _
).CreatePivotTable TableDestination:="", tablename:="PivotTable3"
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(1, 1)

How can I change to R1C1 style from activesheet.UsedRange?
SourceData:="Sheet1!R3C3:R261C21"

Thanks.

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson