+ Reply to Thread
Results 1 to 6 of 6

Macro not continuing with other lines of code, when there are no records to delete

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Gulbarga
    MS-Off Ver
    Excel 2007
    Posts
    15

    Lightbulb Macro not continuing with other lines of code, when there are no records to delete

    Hi,
    I have a macro to delete some unwanted records and for doing some other things also.
    That part of the code which is used for deletion of unwanted records is as under:
    Please Login or Register  to view this content.
    But this code gives error as under, when there are no records to delete:
    Run-time error:1004
    No cells found
    Debug End Help


    If I opt for debug, cursor is placed against the last line of the above-mentioned code.
    If there are no records to be deleted, I want the macro to continue with the next lines of code, without halting.
    Please help me to modify this code accordingly.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Macro not continuing with other lines of code, when there are no records to delete

    Hi cbk40060,

    Though it won't fix the issue, you can prevent the error message appearing which will let the code continue via this method:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Gulbarga
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Macro not continuing with other lines of code, when there are no records to delete

    Dear Robert,
    Please pardon me, if what I am asking you is too elementary.
    Because I am a novice in macros.
    Does ON ERROR RESUME NEXT means go to the next line of code in the macro?
    Again, what is the meaning of ON ERROR GO TO 0 .
    The next lines of code are as under:
    Please Login or Register  to view this content.
    I want the macro to continue with these lines of the macro code.

    Regards,

    CBK

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Macro not continuing with other lines of code, when there are no records to delete

    Hi CBK,

    ON ERROR RESUME NEXT instructs the code to continue without notice (i.e. error message) if there's an error. ON ERROR GOTO 0 resets the code so that error messages are displayed.

    If the line of code in my example is where the issue is, the code should be continuing

    Robert

  5. #5
    Registered User
    Join Date
    02-06-2013
    Location
    Gulbarga
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Macro not continuing with other lines of code, when there are no records to delete

    Thanks Robert.

    It solved my problem.

    CBK

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Macro not continuing with other lines of code, when there are no records to delete

    Glad to hear it

    If you could mark the thread as solved it would be appreciated

+ 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] Code to delete records in list box from sheet
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 01-12-2014, 12:04 AM
  2. Macro code needed to delete unnecessary data after 20 lines
    By mohammedfaizal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2013, 08:36 AM
  3. [SOLVED] Continuing Number Sequences with Lines
    By alex.diederich in forum Excel General
    Replies: 27
    Last Post: 04-06-2013, 07:56 AM
  4. [SOLVED] Macro to Delete useless lines, rearrange by dates and skip lines between different days.
    By Tmc2159 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-12-2012, 02:15 PM
  5. How to delete duplicated records. Each record has four lines
    By Arcesio Hernandez in forum Excel General
    Replies: 2
    Last Post: 07-26-2005, 07: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