+ Reply to Thread
Results 1 to 5 of 5

Delete rows if condition are met in a particular column

  1. #1
    Forum Contributor
    Join Date
    10-31-2013
    Location
    india
    MS-Off Ver
    Excel 2019
    Posts
    147

    Delete rows if condition are met in a particular column

    Sir,

    I have done the following macro code to delete rows when conditions are met in a particular column.

    The macro code works fine for small data. But it takes long time for big data.

    Is there any other macro code to speed up the execution time.

    I have attached sample workbook for your reference. Kindly help.

    Sub Delete_rows()

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    Dim sh1 As Worksheet
    Dim lastrow As Long
    Dim i As Long
    Set sh1 = ThisWorkbook.Worksheets("Delete")

    lastrow = sh1.Cells(Rows.Count, "A").End(xlUp).Row

    For i = lastrow To 2 Step -1

    If sh1.Cells(i, "B").Value = "STATIONERY" Or sh1.Cells(i, "B").Value = "VEGETABLES" Then

    sh1.Cells(i, "A").EntireRow.Delete

    Else

    End If

    Next i

    Application.ScreenUpdating = True
    Application.DisplayAlerts = True

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete rows if condition are met in a particular column


    As it can be done faster without any VBA code just using a filter …

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Delete rows if condition are met in a particular column

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    10-31-2013
    Location
    india
    MS-Off Ver
    Excel 2019
    Posts
    147

    Re: Delete rows if condition are met in a particular column

    sir,

    Thanks for your suggestion

  5. #5
    Forum Contributor
    Join Date
    10-31-2013
    Location
    india
    MS-Off Ver
    Excel 2019
    Posts
    147

    Re: Delete rows if condition are met in a particular column

    Dear All

    Kindly let me know the date and time for posting new thread

    Regards

+ 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. [SOLVED] Delete rows with condition
    By jimpatel1993 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-15-2021, 01:12 PM
  2. [SOLVED] Delete rows if column A matches number and meets condition in another column
    By stokiejames09 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-05-2014, 05:03 PM
  3. [SOLVED] Delete Rows with condition
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2014, 05:12 PM
  4. How to delete rows based on a met condition between two rows
    By dijimbob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-23-2014, 05:11 PM
  5. [SOLVED] delete certain rows VBA - with condition and containing zero
    By kamran_ijazz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2012, 06:08 AM
  6. Delete Rows If condition not met
    By Pasha81 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-17-2009, 02:48 PM
  7. delete rows when the condition is met
    By tweety127 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2008, 09:46 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