+ Reply to Thread
Results 1 to 4 of 4

Need to add if error code to worksheet change event to stop a run-time error

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Need to add if error code to worksheet change event to stop a run-time error

    Hi all,

    I have a code that produces a mssg box if any "P" value is selected (data validation) in column A. The mssg box allows the user to specify how many additional lines they need to add, and adds them by copying the line x number of times. However, I often encounter a run-time error that completely freezes excel and forces me to quit excel via task manager. Is there and if error code I could tie around this?

    Any help would be greatly appreciated.


    Please Login or Register  to view this content.
    As you can see, I tried implementing my own if error code but it did not work. I still ran into the problem of excel shutting down.
    Last edited by KT99; 11-18-2014 at 10:12 AM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Need to add if error code to worksheet change event to stop a run-time error

    It would be better to figure out what is causing the error and fix that rather than trying to side step if an error occurs. I have a feeling your error is coming from the For/Next loop. In fact, if I understand correctly, the loop isn't neccessary at all. Unfortunately, I can't give you an exact answer because I am not able to fully comprehend what you are doing. Maybe this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Need to add if error code to worksheet change event to stop a run-time error

    Sorry, let me try and describe it more adequately. I have a list of accounts I need to send out to each customer (obviously each list of accounts is different). It shows up as default for the customer. The customer has to go into the list and select from a drop down menu (data validation) either a Y, N, or P. If the customer selects a P, they are forced to add more rows. The customer inputs x number of rows they wish to add, and the macro copies the information and shifts the existing rows down x rows.

    The change event is when a customer selects the P function. You don't think a loop is needed?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Need to add if error code to worksheet change event to stop a run-time error

    Did you try the amended code? I does what you describe.

+ 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] Stop Worksheet change event from interfering with macro code
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 09:11 PM
  2. Run Time error due to event change code when I delete columns in file
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2012, 12:53 PM
  3. runtime error, isempty, worksheet change event
    By Code Flunkie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2011, 05:17 PM
  4. Stop code from triggering worksheet event
    By mashley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2010, 11:47 AM
  5. Replies: 5
    Last Post: 06-23-2005, 06:05 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