macros只能删除0.00而不是150.00等值

我创build了一个macros来search一个列,并删除整个行,如果值是0.00。 问题是它也删除包含该string的所有行,即140.00,150.00等…所以我失去了良好的数据。 不知道如何解决?

我的macros:

Dim c As Range Dim SrchRng Set SrchRng = ActiveSheet.Range("J5", ActiveSheet.Range("J65536").End(xlUp)) Do Set c = SrchRng.Find("0.00", LookIn:=xlValues) If Not c Is Nothing Then c.EntireRow.Delete Loop While Not c Is Nothing 

谢谢你的帮助

尝试以下操作:

 For i = ActiveSheet.UsedRange.Columns("J").Cells.Count to 5 Step -1 If Range("J" & i).Value = 0# Then Range("J" & i).EntireRow.Delete Next 

试试看,让我知道你的意见

你可以一次删除想要的行:

 With Range("J4", Cells(Rows.Count, "J").End(xlUp)) '<--| assuming "J4" cell is the "header" of data in cells from "J5" down to last column J not empty cell .AutoFilter Field:=1, Criteria1:="0.00" '<--| filtre cells whose content is "0.00" If Application.WorksheetFunction.Subtotal(103, .Cells) > 1 Then .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete '<--| if any cell found other than header then delete corresponding rows (skipping headers) .Parent.AutoFilterMode = False End With