View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Debug, Please help

The code can't find tablename or source data is not in R1C1 format.


1) If Table range is a named range then try this

from
ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Sqlstring, tablename:="Table1"

to
ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Sqlstring, tablename:=Range("Table1")


2) Make sure source data is in R1C1 format
"Consolidation!R1C1:R2C2"


"Michael" wrote:

Hi,

Could anyone please help with the following code. When I ran it, it
said: "Error 1004"

ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Sqlstring, tablename:="Table1"

Thanks a lot!!

Michael