Results 1 to 2 of 2

Thread: Macro runs in some computers, in others not...
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2018
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Macro runs in some computers, in others not...

    Hello all,

    I created a macro that creates a pivot table based on a dynamic range, in order to generate a report.
    When I run it in my computer, everything goes ok, however, when I run it in someother computers, the follow error message appears:

    Run-time error '5':
    Invalid procedure call or argument

    When I debug, I can see the problem lies in this code:

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Dados!A1:AU" & nlinhas, Version:=6).CreatePivotTable TableDestination:= _
    "Report_DR!R11C1", TableName:="PivotTable1", DefaultVersion:=6

    I already changed some excel options related with Trust Center, however the problem persists.

    What can I do?

    Thank you.

  2. #2
    Administrator starl's Avatar
    Join Date
    Aug 2002
    Location
    Everywhere!
    Posts
    5,859
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro runs in some computers, in others not...

    Are they using the same version of Excel as you are? You're specifying Excel 2016, I believe.
    Also, does the SourceData exist? Does the Destination?
    Finally - is there another pivot table named PivotTable1?

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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