+ Reply to Thread
Results 1 to 4 of 4

Delete all non Bolded rows VBA

  1. #1
    Registered User
    Join Date
    12-07-2018
    Location
    canada
    MS-Off Ver
    2018
    Posts
    30

    Delete all non Bolded rows VBA

    Hi there,

    I have to delete all non-bold rows in a worksheet and i have the following code. It does what I need but I have to run it multiple times in order to delete ALL the non bolded rows.

    I cant seem to figure out why I have to run it multiple time and want to only run it once.

    Please Login or Register  to view this content.

  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
    49,106

    Re: Delete all non Bolded rows VBA

    Change this:
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    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
    12-07-2018
    Location
    canada
    MS-Off Ver
    2018
    Posts
    30

    Re: Delete all non Bolded rows VBA

    thanks so much

  4. #4
    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
    49,106

    Re: Delete all non Bolded rows VBA

    You're welcome. Thanks for the rep.


    I should have explained: when you start at the top and go down, as you delete one or more rows, the remaining rows move up ... but the counter doesn't take that into account and the loop effectively leapfrogs over some rows that meet the criteria.

    There are other ways to go about this. You could, for example, loop through from the top and "build a range" of cells that meet the criteria. Then, at the end, you delete all the rows in that range in one go. That can be more efficient and would be useful if you had a very large number of rows to process.

    If the cells were coloured rather than bolded, you could use AutoFilter to list all the non-coloured rows, then select and delete all the visible rows (the non-bold rows)

+ 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. Rows delete formula as per range of cell values with counter to delete # rows
    By qureshi2016 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-03-2017, 09:35 AM
  2. Delete all rows with Amount under $250,000 and bolded
    By conchhouse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2016, 09:02 AM
  3. VBA to highlight row if cell is bolded
    By devilchild99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2013, 01:12 AM
  4. the sum of all bolded numbers
    By Sam12345 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-20-2005, 11:25 PM
  5. Delete bolded items in column
    By Annette in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2005, 03:05 PM
  6. how to sort list, bolded items from no bolded?
    By tcd50 in forum Excel General
    Replies: 1
    Last Post: 07-09-2005, 06:05 PM
  7. Delete Non-bolded lines only
    By Annette in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2005, 04:05 PM

Tags for this Thread

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