none
VBA Runtime Error 1004 when using MS Office 365 ProPlus RRS feed

  • Question

  • Hi - I am spinning my wheels trying to figure out what is going on here.

    I created a macro in MS Excel 2013 that runs just great on other computers running the same version.  However, when someone who has MS Office 365 ProPlus tries to run the same macro, they get an error:

    "Run-time error '1004':

    To copy all cells from another worksheet to this worksheet, make sure you paste them into the first cell (A1 or R1C1).

    This macro does not include any code for copying cells from one worksheet to another, and all actions are entirely contained to a single worksheet.

    When I go to debug, it shows that the line of code causing the problem is this one, which makes no sense:

        Rows("2:5").EntireRow.Insert

    The macro lives in a module and not a the sheet level.  What is going on that this specific piece of code does not work in MS Office 365?

    Thanks in advance!

    Wednesday, October 11, 2017 3:54 PM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel features, I'll move your question to the MSDN forum for Excel

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,
    Emi Zhang
    TechNet Community Support

    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, October 12, 2017 5:52 AM
  • Hello,

    maybey try to clear your clipboard before inserting the lines?

    Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function EmptyClipboard Lib "user32" () As Long
    Public Declare Function CloseClipboard Lib "user32" () As Long

    Public Function ClearClipboard()
        OpenClipboard (0&)
        EmptyClipboard
        CloseClipboard
    End Function

    Hope it helps,

    Wouter

    Thursday, October 12, 2017 1:11 PM
  • Hi hpilloud,
    I failed to reproduce your issue. I could get error if I copied the a range and then run the code, but the error message is different. I could get the same error when copying a whole sheet and the paste it into a cell that is not A1.
    I would suggest you share us the whole code and your test step so we could try to reproduce your issue. Thanks for understanding.
    Best Regards,
    Terry

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 13, 2017 10:03 AM
  • Hello,

    Do you resolve your issue? We would appreciate if you could share your solution here, it might be of great help for others.

    If the issue persists, would you get the error when you insert rows manually? I suggest use Application.CutCopyMode = False before inserting new rows.

    As the code works in Office 2013, what Office build version of your Office 365? To check if the issue is related to Office update or different office version, you could update to the latest version or follow the link below to revert to an earlier version.

    How to revert to an earlier version of Office 2013 or Office 2016 Click-to-Run

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 30, 2017 9:46 AM
    Moderator