runtime error 91

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slowmotion
    New Member
    • Aug 2007
    • 3

    runtime error 91

    Hi,
    I'm getting this error when I run this macro from excel. Is there any way this can fix? Could someone revise this and explain to me what went wrong.

    [CODE=vb]ActiveWorkbook. PivotCaches.Add (SourceType := xlDatabase, SourceData := _
    "maxtotals!R1C1 :R1375C12").Cre atePivotTable TableDestinatio n := "", TableName:= _
    "PivotTable 3", DefaultVersion := xlPivotTableVer sion10
    ActiveSheet.Piv otTableWizard TableDestinatio n := ActiveSheet.Cel ls(3, 1)[/CODE]
    Last edited by Killer42; Aug 17 '07, 02:22 AM. Reason: Added [CODE=vb] tag
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    It might help debugging if you break the actions into separate statements. In other words, do a create, then an add, rather than strining it all together. I'm not saying it won't work this way, just that breaking it down will make it simpler for us mere mortals to follow.

    Comment

    • slowmotion
      New Member
      • Aug 2007
      • 3

      #3
      Hi could you post an example from the code I provided. I would greatly appreciated.
      Thanks

      Comment

      • slowmotion
        New Member
        • Aug 2007
        • 3

        #4
        know I'm getting the error "compile error-expected block" I could'nt tell if you made any changes from your first reply.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by slowmotion
          know I'm getting the error "compile error-expected block" I could'nt tell if you made any changes from your first reply.
          I didn't change anything, except to put in the "CODE=vb" and "/CODE" tags. However, if you did a copy/paste from the message, some browsers have a bit of difficulty with the line number.

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by slowmotion
            Hi could you post an example from the code I provided. I would greatly appreciated.
            Sorry, but I've got a really old version of Excel here at home, and it won't even accept xlPivotTableVer sion10 as existing. So there are probably too many differences. Plus, I do tend to get a bit lost, playing with objects like this. It always take a fair bit of trial and error to get working.

            Comment

            Working...