+ Reply to Thread
Results 1 to 13 of 13

Excel always crashes at the very same point of the code

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Excel always crashes at the very same point of the code

    Hi community

    I've still got some serious trouble with a Excel-document I'm working on. It's a file supposed to compare offers from various building firms. Thus I wrote a button-released code to sort the offers from cheapest to most expensive. I think the code should be all right by now, but every time I run it, excel crashes (with "runtime error 9: subscript out of range", when I press "debug", the program shuts down). By step by step running the code, I figured that it always crashes on line 14, no matter whats wirtten on this line. This made me think it might be a software-problem. But I tried running it on an other computer and had the same Problems. I also tried copy-paste into another file, but it didn't solve my problems neither
    As attachment you will find the file. I'm sorry it's in German. The row to be sorted on is row 43.
    I'm using windows 7 and ms-office 2010 professional plus. in case that helps ;-)

    Thanks a lot for your help!
    Greets
    Freakygreeneyes
    Attached Files Attached Files
    Last edited by freakygreeneyes; 07-26-2013 at 10:23 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel always crashes at the very same point of the code

    The code errors here because there's no workbook called '03_Submissions-AnswertungTest.xlsm' open.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Excel always crashes at the very same point of the code

    hi Norie
    Oh I really just got this myslef. I changed the name of the file i uploaded, so i could delete a few things due privacy reasons and just forgot to adapt the code. I already loaded up the corrected file where the other one was.
    Thanks anyways

    Greets

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel always crashes at the very same point of the code

    If you are trying to refer to the workbook the code is in use ThisWorkbook.

  5. #5
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Excel always crashes at the very same point of the code

    Tried that bevor, doesn't change anything...
    thanks

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel always crashes at the very same point of the code

    Are you trying to refer to the workbook the code is in?

  7. #7
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Excel always crashes at the very same point of the code

    Dear Norie

    Sorry for having you waiting so long for me to answer...
    Yes, I'm trying to refer to the workbook the code is in. Does that explain my problem somehow?

    Greets

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Excel always crashes at the very same point of the code

    Ran the code on my old machine with 2007 and worked OK, meaning no runtime error after deleting the

    Please Login or Register  to view this content.
    line

  9. #9
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Excel always crashes at the very same point of the code

    Hey jolivanes

    I just tried your tip. Strange, it still doesn't work on my Office 2010, but it actually does on my office for mac 2011.
    Is there any reason apparent, why it doesn't work on Office 2010?
    Greets

  10. #10
    Registered User
    Join Date
    07-17-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Excel always crashes at the very same point of the code

    Hey communitiy

    I tried saving the workbook in office version 97-03. Now it works! Thats quite good, but it would be better if it did also work for Office 2010, so I'm looking forward to hear from you, if you know whats screwing my code uf in office 2010.
    So far, thanks for your help!

    Greets!

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Excel always crashes at the very same point of the code

    Hi,

    I can't tell you why that would be. I don't have 2010 to try it with.
    Someone with 2007 and 2010 hopefully will get you the answer.
    Good luck

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel always crashes at the very same point of the code

    I can't fathom the reason but it crashes when it assigns the sheet to the wsAuswertung variable. if you copy the sheet and use the copy in the code instead it seems to work ok
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel always crashes at the very same point of the code

    If you copy all the sheets to a new workbook the code seems to work fine after changing it to use ThisWorkbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Excel Crashes when adding code to workbook via VBA
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-24-2009, 01:10 PM
  2. Excel crashes when I create code through a routine
    By Caligula in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2007, 03:55 PM
  3. My code crashes excel
    By ben_sumner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-06-2006, 03:20 AM
  4. Excel crashes when code runs, Please help.
    By Potoroo in forum Excel General
    Replies: 2
    Last Post: 09-12-2006, 08:39 PM
  5. [SOLVED] VBA WinInet Code Crashes Excel
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2006, 12:55 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