ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Debug, Please help (https://www.excelbanter.com/excel-programming/432650-debug-please-help.html)

Michael[_49_]

Debug, Please help
 
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


Michael[_49_]

Debug, Please help
 
On Aug 20, 5:04*pm, 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



I figured out the code now. Now Could anyone please post some code
when I wanan change the SQL in an existing pivottable to get it
refreshed? Thanks a lot. Mike


joel

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



joel

Debug, Please help
 
Can you show a sample of the SQL that you are referreing to? Maybe record a
macro while manually creattig the table and posting the code.

"Michael" wrote:

On Aug 20, 5:04 pm, 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



I figured out the code now. Now Could anyone please post some code
when I wanan change the SQL in an existing pivottable to get it
refreshed? Thanks a lot. Mike




All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com