+ Reply to Thread
Results 1 to 6 of 6

Loop to delete rows based on value.

  1. #1
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    152

    Loop to delete rows based on value.

    I have the below code but it doesnt seem to work, ive run through the code and if seems to be looping and looking at each cell but it never executes the rows(Rw).delete.


    is there something im missing here?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: Loop to delete rows based on value.

    Hi,

    you could try going through the code with F8 to execute the code line by line and see what each step does. (Minimize the code window to be able to see the worksheet too.)

    edit: you could also add messageboxes to check what values are assigned to your variables. For example:
    Please Login or Register  to view this content.
    This way you can easily debug your code and see where it goes wrong.
    Last edited by RHCPgergo; 11-04-2012 at 06:24 AM.

  3. #3
    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,349

    Re: Loop to delete rows based on value.

    You're always looking at the same cell: Cells(LastTableCell,"E") ... Should be Rw.

    Regards, TMS
    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


  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loop to delete rows based on value.

    Try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    152

    Re: Loop to delete rows based on value.

    thanks tmshucks i see what i was doing now, im getting there slowly, many thanks works fine now.

  6. #6
    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,349

    Re: Loop to delete rows based on value.

    You're welcome.

+ 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