Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: VBA Code Breaks During Runtime But Not In Debug Mode

  1. #11
    My reference library looks like this...
    Refs VBA.jpg

  2. #12
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Well, can you try to copy all of your code somewhere, and save the file as a non-macro XLSX file. And then reopen Excel, and add back all the modules and the userform and copy all the VBA codes, and then save as a macro enabled XLSM file.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #13
    Thanks Excel fox, done that but not working, But..... I have had a slight breakthrough in understanding whats going wrong. I added a button to the sheet 1 and wrote a macro to call the initial form. When I do this and run the code behind the form there is no problem and so this means the issue is happening because of the method in which I am calling the form, which is on the Workbook Open() event i.e form1.show

    When i open the workbook and form pops up the code breaks as the range is not recognized in the class but when the form is called after the workbook is open there is no issue.

  4. #14
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Ah! That's a reasonable conclusion. And that's probably because the worksheet object as well as the range objects aren't loaded, and only after the workbook open event is completely executed do those objects load. Well, you've probably nailed it there.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  5. #15
    brilliant, thanks for all your help. In which case I guess i will have to 'Show' the form when the macro is manually started. we got there in the end

Similar Threads

  1. Did You Know :: Bullet Points & Line Breaks in Excel Cells
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 1
    Last Post: 06-11-2013, 01:55 PM
  2. Combobox Not Working In Excel Workbook Shared Mode
    By peter renton in forum Excel Help
    Replies: 15
    Last Post: 06-03-2013, 01:25 PM
  3. Changing Slideshow viewing mode to kiosk using vba
    By Times in forum Powerpoint Help
    Replies: 1
    Last Post: 05-10-2013, 12:37 AM
  4. Runtime Error 481 invalid figure when PNG
    By Tony in forum Excel Help
    Replies: 0
    Last Post: 02-12-2013, 12:59 AM
  5. VBA Code Works Only in debug Mode.
    By princ_wns in forum Excel Help
    Replies: 2
    Last Post: 06-17-2012, 06:14 AM

Tags for this Thread

Posting Permissions

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