+ Reply to Thread
Results 1 to 7 of 7

Simple Loop command

  1. #1
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74

    Simple Loop command

    Hi All,

    Really simple question here. I'm trying to delete a row if the value in the Column 62 is 0.

    Here's what I have so far:

    Please Login or Register  to view this content.
    It runs ok and deletes the row but doesn't seem to recognise when the value in column 62 (BJ) is equal to 1.

    can anyone help?

    Thanks
    Ne auderis delere orbem rigidum meum!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,470

    Re: Simple Loop command

    When deleting rows, always start from the bottom.

    Try this:

    Please Login or Register  to view this content.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Simple Loop command

    Hi,

    This seems to work for me, unless I don't understand the problem:

    Please Login or Register  to view this content.
    abousetta

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Simple Loop command

    Also you might want to limit the number of rows unless you always have 9000 rows of data. This seems to be slowing down the macro.

    In general, TMShucks approach is more efficient.

    abousetta

  5. #5
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74

    Re: Simple Loop command

    Quote Originally Posted by abousetta View Post
    Hi,

    This seems to work for me, unless I don't understand the problem:

    abousetta
    Yep, tried it again and it seemed to work.

    I'll try to new code to delete from the bottom.

    Thanks for the help guys.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Simple Loop command

    Also one small detail. Its xlUp instead of x1UP. That might be the source of the problem you were having.

    abousetta

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,470

    Re: Simple Loop command

    Starting from the top can "seem" to work unless you encounter several rows together that meet the criterion. Then you can leapfrog rows.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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