+ Reply to Thread
Results 1 to 17 of 17

Run-time error '1004':

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Run-time error '1004':

    The script works fine, but every time I exit the workbook I get the following run-time error:
    Run-Time error '1004':
    Method 'Worksheets' of object '_Global' failed

    I have attached the code for the sub that is causing the error. It occurs on the first line of the first "If" statement. Any help would be appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    Do you have code in the ThisWorkbook module?

  3. #3
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    No it is located in the "Input" worksheet module, and that is the worksheet where the combo box is located.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    Other code I mean, not what you posted above. If not I wonder it only happens when you exit the workbook. Do you definitely have a sheet called "Parameters"?

  5. #5
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    Sorry about that I misunderstood the question. Yes there is definitely a sheet called "parameters" This is the code in the This Workbook Module:
    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    No close code then. Can you post a workbook?

  7. #7
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    Unfortunately the workbook has a lot of proprietary information it it. I will try to form a new redacted workbook that still produces the same error and post that, but any ideas to try in the meantime would be helpful.

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    Not sure tbh. Does the named range definitely exist on the specified sheet?

  9. #9
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    Yes the named range is on that sheet.

  10. #10
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    Attached is a very stripped down version of the workbook, but it still produces the same error, so hopefully this will help with finding a solution. I am sure it is something simple that I have done wrong. Thank you in advance.Stripped Program.xlsm

  11. #11
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    I don't get that error. I get an error on this line
    Please Login or Register  to view this content.
    and have to confess I have never come across this property before.

  12. #12
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    That's strange I don't get any error on that line. All it does is disable the combobox control on the Input sheet.

  13. #13
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    Oh yes, silly me. If I replace that line with
    Please Login or Register  to view this content.
    the macro runs without error so guess it must have something to do with your set up.

  14. #14
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    So after toggling the combobox and then exiting the application you don't get a run-time error? If that is the case any ideas what in the setup could be causing this on my machine?

  15. #15
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    Well something funny is going on because I can't select the combobox to change the options - perhaps you slimmed it down a bit too much!

  16. #16
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Run-time error '1004':

    There are two combo boxes. The first one should be enabling or disabling the second one.

  17. #17
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Run-time error '1004':

    But I can't change the first one and I can't even insert a new control. I wonder if your file could be corrupt.

+ 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] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  2. Addon error : Run-time error '1004': Method 'MacroOptions' of object '_Application' failed
    By jtcoleman in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 02-05-2014, 12:23 PM
  3. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. [SOLVED] run-time error '1004': Application-defined or object-deifined error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2005, 05:05 PM

Tags for this Thread

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