+ Reply to Thread
Results 1 to 4 of 4

Delete rows using Range and xlCellTypeConstants

  1. #1
    Forum Contributor
    Join Date
    02-03-2018
    Location
    Buckinghamshire, England
    MS-Off Ver
    2010
    Posts
    130

    Delete rows using Range and xlCellTypeConstants

    Hi i am trying to find a quick method of deleting a large number of rows in a sheet if a certain cell has a zero in it then delete the row.
    This takes 40 seconds looping through the rows so tried altering a bit of code i found but got stuck.

    Column I has the rows with zeros in. I insert a column and fill it with a formula which puts a 1 in any row to remove. Then i sort the column. This all works.

    Then i need to delete the rows using the line .Columns(5).SpecialCells(xlCellTypeConstants, 4).EntireRow.Clear but obvioulsy the 1 in the cell is not a constant that the code is looking for.

    I tried googling excel constants but did not get very far.

    Can anyone help?

    Thanks

    Neil


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delete rows using Range and xlCellTypeConstants

    Looks from what you have so far, that there are no headers.... so this code will temporarily insert a row at the top to be able to autofilter. That is why the last row variable gets a +1, since the rows will move down one.

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    02-03-2018
    Location
    Buckinghamshire, England
    MS-Off Ver
    2010
    Posts
    130

    Re: Delete rows using Range and xlCellTypeConstants

    Thanks Arkadi

    Worked like a charm and really quick

    Regards

    Neil

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Delete rows using Range and xlCellTypeConstants

    Thanks for the reply, marking the thread as solved, and the rep Neil

    Glad it worked out for you!

+ 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 range of rows
    By cindywylie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2014, 11:10 AM
  3. [SOLVED] For Each c In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants)
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2014, 10:39 PM
  4. [SOLVED] Is it possibe to error trap Range.SpecialCells(xlCellTypeConstants) if found > 1?
    By kjy1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2013, 07:34 PM
  5. [SOLVED] .SpecialCells(xlCellTypeConstants) method quirky behavior in Exel 2010
    By VBA Grunt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2013, 12:01 PM
  6. Reference to xlCellTypeConstants
    By bguenther in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2008, 09:42 AM
  7. Delete a range of rows ?
    By SpookiePower in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-24-2006, 11:25 AM

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