ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   pivot table error.Please help! very urgent (https://www.excelbanter.com/excel-discussion-misc-queries/71330-pivot-table-error-please-help-very-urgent.html)

anu_manu

pivot table error.Please help! very urgent
 

ActiveSheet.PivotTableWizard _
SourceType:=xlExternal, _
SourceData:=Array(strSQL, strSQL1), _
tableDestination:=Worksheets(strSheet).Range("a2") , _
tableName:=strSheet, _
RowGrand:=True, _
ColumnGrand:=True, _
SaveData:=True, _
HasAutoFormat:=True, _
BackgroundQuery:=False, _
Connection:=Array(g_strConn)

its giving me an error
"Run-time error 1004 -- Pivot table wizard method of worksheet class
failed."

it also calls verifyPivot name as strPivot =
VerifyPivotName(strSheet).
strsheet is coming up with value "sheet1".

but the function verifypivotname doesnt show it.
Public Function VerifyPivotName(strSheetName As String) As String
Dim nCount As Integer
Dim strPivot As String

nCount = ActiveSheet.PivotTables.Count
ActiveSheet.Range("a2").Select

If nCount 0 Then
strPivot = Worksheets(strSheetName).PivotTables(1).Name
Else
VerifyPivotName = "-99990000"
Err.Raise 2
Exit Function
End If

cud this be a possibility tht i hav to name the pivot table first. if
yes how?
please help .


--
anu_manu
------------------------------------------------------------------------
anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510
View this thread: http://www.excelforum.com/showthread...hreadid=511867



All times are GMT +1. The time now is 09:13 AM.

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