+ Reply to Thread
Results 1 to 4 of 4

2 issues : Sub call not working + Excel crash

  1. #1
    Registered User
    Join Date
    11-20-2012
    Location
    Haarlem, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    9

    2 issues : Sub call not working + Excel crash

    The macro I am currently working on presents two issues :

    1- It completes fine, but totally ignores the sub procedure called somewhere around the end (Sub Test() ).

    2- Again, it runs without giving an error. But when I go back to my Excel sheet to delete data created by the macro (so I can test it again), Excel invariably crashes. After 2 or even 3 attempts at restarting Excel, I manage to delete the data, so I can re-run my macro.

    Here is the code :

    Please Login or Register  to view this content.
    Here is the sub being called :

    Please Login or Register  to view this content.
    Any ideas ?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: 2 issues : Sub call not working + Excel crash

    Hi,

    When you say it 'completes fine', do you know for a fact by stepping through the macro that it has completed?
    Or do you mean the macro has run without debugging.

    If the called macro isn't being run then that suggests that either the IF test has failed or the called macro has in fact run but just not changed any colours.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-20-2012
    Location
    Haarlem, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: 2 issues : Sub call not working + Excel crash

    Thank you for your interest, Richard.

    Apart from the called subprocedure, I get all the expected outputs from my macro : Excel sheets get updated, saved, closed, no problems.

    I went through the code using the F8 key. It stops on the line called "Test" (the subprocedure I'm trying to call), does not move to the subprocedure at all, and just carries on to the next line of code. It just ignores the command.

    If I replace the procedure calling with the actual steps of what the procedure is supposed to do (change colours), it works. The reason why I want to call it as a separate procedure is that the actual code that should be added in there is very long, and I want to exclude it from the main program.

    Some more ideas ?

  4. #4
    Registered User
    Join Date
    11-20-2012
    Location
    Haarlem, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: 2 issues : Sub call not working + Excel crash

    Richard, by doing some more testing, I found the issue.

    To call the procedure, I should call the module first. The line should say :

    ModuleName.Test
    Test


    Then it works.

    Now I still need to figure out why Excel crashes every time I run the macro. Have you seen this happening before ?

+ 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. Errors: Microsoft Excel has stopped working - crash in pivot table
    By EvaLina in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-12-2014, 09:58 AM
  2. Working out cost of a phone call in excel from seconds
    By JohnD0e in forum Excel General
    Replies: 4
    Last Post: 05-10-2011, 11:10 PM
  3. Call code not working
    By IDrinkAlone in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-23-2011, 09:55 AM
  4. Call up Macro's Not working
    By Lew_SJH in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-04-2011, 10:24 AM
  5. Call function not working
    By abz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2010, 07:16 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