+ Reply to Thread
Results 1 to 4 of 4

Unexplainable Run-time error 1004 from hide/unhide rows code

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    131

    Lightbulb Unexplainable Run-time error 1004 from hide/unhide rows code

    Hi All,

    I have a sheet I am using as a user form that on a button press creates an email with a PDF of the sheet attached to it. During the execution of the macro several rows are hidden and unhidden to set the sheet up for the recipient of the email and then to set the sheet in a 'sent' state for the sender. I deliberately used hide/unhide rows due to the worksheet change event that interferes with the protected state of the sheet.

    When the SendButton macro (code attached to sheet1) is called from the send button everything runs perfectly up to the error message 400 with no other explanation. When I step through the the SendButton macro to debug, the error occurs at line 303 - Run-time error '1004': Application-defined or object-defined error.

    Line 303:
    Please Login or Register  to view this content.
    I have no idea why as the worksheet is still in a an unlocked state when the error occurs and works for the previous two hide/unhide row actions. I just cant see why this line should give an error. I've attached the sheet. I'm wondering if I missed something or if this is a glitch with excel 2013.

    Any help is greatly appreciated!

    Thanks,
    Attached Files Attached Files
    Dave C

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,542

    Re: Unexplainable Run-time error 1004 from hide/unhide rows code

    I put a break point on that line, run the code it stops at the break point and then I go to the sheet and try to manually hide those rows.
    I get a popup error message.
    "Cannot shift objects off sheet."
    ActiveX object maybe?
    I don't know what you have on there, but maybe it's locked or something, modal?
    As a reminder, once your original request has been fulfilled please mark this thread as SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

    If you are happy with my help, then please consider clicking the add reputation button in the lower left hand corner of this post.

  3. #3
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    131

    Re: Unexplainable Run-time error 1004 from hide/unhide rows code

    Thanks for the reply skywriter. There are no ActiveX objects on the sheet and the three form control buttons (hidden and unhidden) are not locked. I'm not sure what modal means but I'm happy to explain my sheet further if needed.

  4. #4
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    131

    Re: Unexplainable Run-time error 1004 from hide/unhide rows code

    This is solved (to a point). I managed to get around the "Cannot shift objects off sheet" error by deleting Rows("22:34") instead of trying to hide them. They were not needed on the sheet after that point anyway.

    However, if anyone can explain further why the error occurred, that would be amazing. Thanks again to skywriter for your input.

    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. [SOLVED] Formula or code to hide or unhide rows based on value in a cell
    By pongmeister in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-26-2015, 10:34 AM
  2. Vb code to hide/unhide rows based on entries on another sheet
    By tcrjmom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2015, 01:15 PM
  3. [SOLVED] Specific macro or VBA code to hide and unhide rows
    By louvaek in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-17-2014, 07:36 AM
  4. Hide/Unhide rows based on system time?
    By Johnnyellow23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2013, 03:55 PM
  5. [SOLVED] How VB code can unhide/hide rows based on combobox selection?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 01:25 PM
  6. Code to Hide and Unhide Rows
    By jcoulter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2012, 10:38 AM
  7. Hide/Unhide Rows VBA code Changes Help
    By Justinmih in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-12-2011, 04:24 PM

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