+ Reply to Thread
Results 1 to 3 of 3

Row deletion

  1. #1
    Registered User
    Join Date
    01-12-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    2

    Row deletion

    Disclaimer: I have no idea what I am doing with VB; I work in the C family.

    Currently we have excel workbooks in which specific rows need to be deleted (skip 2, delete 3).

    I spaghetti'd this together and it seems to be working:
    Please Login or Register  to view this content.
    When run, this works as I want it to.

    However, when flipping statement comments (eg, comment out the BG change and uncommenting the row deletion), it gives me wildly inaccurate deletions.

    Anyone know what I am doing wrong?

  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
    44,093

    Re: Row deletion

    Delete from the bottom up :-)

    For Cnt = 505 to 1 step -1

    You might need to adjust your logic ... maybe, step -5

    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
    Registered User
    Join Date
    01-12-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Row deletion

    Quote Originally Posted by TMShucks View Post
    Delete from the bottom up :-)

    For Cnt = 505 to 1 step -1

    You might need to adjust your logic ... maybe, step -5

    Regards
    Excellent, thank you. I didn't realize you could do that, maybe VB isn't so horrible after all.

    For anyone who is interested, this is the working code. (I hate googling & finding these posts with no solution posted at the end.)

    Please Login or Register  to view this content.
    Last edited by mtfd; 01-13-2011 at 11:25 AM.

+ 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