View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pete Straman via OfficeKB.com Pete Straman  via OfficeKB.com is offline
external usenet poster
 
Posts: 1
Default macro statement will not run a second time without closing and reopening

I recorded a macro that created two pivot tables from an external DB. The
first time it runs in "Book1" ok. The second time the statement below
causes a run time error. I have to close and re-open excel to make it run
all the way through on another database. What can I do to make it run in
"Book2" etc. without having to close and re-open excel.

'******* Run time error 1004 unable to get the Pivot Tables property of the
worksheet class

ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:="dosmoyr", _
ColumnFields:="transmoyr", PageFields:="facilityid"

Pete Straman

--
Message posted via http://www.officekb.com