+ Reply to Thread
Results 1 to 3 of 3

Fix error of macro (code '1004')

  1. #1
    Registered User
    Join Date
    10-08-2011
    Location
    Hanoi Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    46

    Fix error of macro (code '1004')

    Hi everyone,

    I create the attached file and I put VBA Codes in each Sheet, not Module as well as VBA codes apply for whole workbook. Please see the VBA Codes that I make. However, the VBA Codes dedicate in the Sheet 'Report by Person' also run when open the Sheet 'Report by Form No' and generate the error code '1004' saying that Unable to get the PivotTables ptoperty of the Worksheet class. Furthermore, when I put the file on the share folder of my company to enable people to input their own data, the VBA Codes in the Sheet 'Report by Person' also generate the error code '1004' saying that Method 'RefereshAll' of object '_Workbook' failed.

    Could anyone help me fix them?

    Thank you so much for your help.

    Regards,
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Fix error of macro (code '1004')

    I did not get an error once I have changed the line on sheet from 'Report by Person
    activesheet.PivotTables("PivotTable1")
    to


    With Me.PivotTables("PivotTable1")

  3. #3
    Registered User
    Join Date
    10-08-2011
    Location
    Hanoi Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Fix error of macro (code '1004')

    Thank AB33 so much. It works with me too.

    I will test this file by putting it on network share folder to check if the second error happens.

    If yes, I would like to have your help fix it.

    Best Regards,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro code to show userform bringing runtime error 1004
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2015, 02:59 AM
  2. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  3. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  4. I get a 400 error or 1004 error depending on where I run the code
    By mouseman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2013, 10:38 AM
  5. [SOLVED] Getting Error 1004 Object or Application Defined Error - Code to rearrange data
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-10-2013, 12:10 PM
  6. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  7. Run-time error 1004 on macro generated code
    By BGiffin2004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2011, 11:01 AM

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