+ Reply to Thread
Results 1 to 3 of 3

getting an error for PIVOT table

  1. #1
    Registered User
    Join Date
    08-03-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    1

    getting an error for PIVOT table

    Hi forum,

    I am running macro to create PVIOT table where row can be different on each day. and once i'm running below posted code i'm getting an error "Invalid procedue or call an argument" :


    Could you please advise?

    lastrow = ActiveWorkbook.Worksheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Row
    ' WBPivot.Names.Add Name:="Database", RefersTo:="=Sheet1!$A$1:$H$" & lastrow 'add a named range set to data range


    ActiveWorkbook.Sheets.Add.Name = "Pivot Table"
    Sheets("Pivot Table").Select
    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
    "Sheet1!$A$1:$H$" & lastrow).CreatePivotTable TableDestination:= _
    "'Pivot Table'!R3C1", TableName:="PivotTable1", _
    DefaultVersion:=xlPivotTableVersion10



    Regards,
    Simpson1

  2. #2
    Registered User
    Join Date
    07-29-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: getting an error for PIVOT table

    Which line of code is returning the error?
    Regards,
    Eddie

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: getting an error for PIVOT table

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1