Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6391779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:43:54+00:00 2026-05-25T03:43:54+00:00

My Task is I have to delete the entire Row if The K column

  • 0

My Task is I have to delete the entire Row if The K column Has zero value in it.First thing came to my mind is looping But i have 4000 rows and 1000 rows may have K value as zero.

Sub DeleteRowWithContents()
       Last = Cells(Rows.Count, "D").End(xlUp).Row
       For i = Last To 1 Step -1
           If (Cells(i, "K").Value) = 0 Then
              Cells(i, "A").EntireRow.Delete
           End If
       Next i
End Sub

I believe People say Its Time taking Process as it is looping. Thats why I thought better go for next methods and People also told me ‘Find’ is much faster than looping. So I have used the below code That I found when I was googling

Sub Delete_zeros()
    Dim rCell As Range
    Dim strAddress As String
Application.ScreenUpdating = False
ThisWorkbook.Sheets(1).Activate
    With ActiveSheet.Columns("K")
        Set rCell = .Find(What:=0, LookIn:=xlValues, SearchOrder:=xlByColumns)
        If Not rCell Is Nothing Then
            Do
            strAddress = rCell.Address
            rCell.EntireRow.Delete
            Set rCell = .FindNext(Range(strAddress))
            Loop Until rCell Is Nothing
        End If
    End With
Application.ScreenUpdating = True
End Sub

But I found That the above code, it is also deleting the row if the k column has 10 or 20 Value in it. I mean if the Digit contains zero then its deleting

example .

    204 or 200 or 205 or 301 or 10 \ Its deleting all these rows

Whats wrong with these code? These code is too fast than looping I wanted to use but I found bug with it.

Please explain the reason to the bug. And any help to other method which is faster in deleting the rows if it has zero value in K column other than looping or (might be also looping should be too fast )? That would be greatly appreciated. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:43:55+00:00Added an answer on May 25, 2026 at 3:43 am

    Not is bug, add this parameter in find method

    LookAt:= xlwhole

    To use filter do

    Sub FilterAndDelete()
    'Developer by Bruno Leite
    'http://officevb.com 
    
        Dim Sht As Worksheet
        Dim FilterRange As Range
        
        'Set your Sheet
        Set Sht = ThisWorkbook.Sheets("Plan2")
        
        'Verify if is Filter
        If Sht.FilterMode Then
          Sht.ShowAllData
        End If
        
        'Filter Column A with 0 at parameter
        Sht.Range("A:A").AutoFilter Field:=1, Criteria1:="0"
        
        'Define Range Of Visible cells without row title
        Set FilterRange = Sht.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible)
           
        Application.DisplayAlerts = False
        
        FilterRange.Rows.Delete
        
        Application.DisplayAlerts = True
            
        Sht.ShowAllData
        
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a task that requires me to delete all folders in a directory
i have task which takes a parameter and has three modes of results Example
I have next task - prohibit all users(except admin) to delete a content in
Anytime I delete a file in VisualStudio, the entire thing freezes and needs to
I have what should be an easy task: delete <places> nodes and their descendants
I have an XML file: <tasks> <task name=task-12> <step>Open folder</step> <step nextTask=task-14>Delete contents.</step> </task>
I have a Todo List (an ASP.MVC UserControl) that for each row has the
I am using MSBuild and have a Delete task that deletes all the files
At first I thought I'm facing a very simple task. But now I realized
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.