![使用“If”函数删除数据](https://linux22.com/image/1466935/%E4%BD%BF%E7%94%A8%E2%80%9CIf%E2%80%9D%E5%87%BD%E6%95%B0%E5%88%A0%E9%99%A4%E6%95%B0%E6%8D%AE.png)
在 Excel 中,是否可以使用vlookup
或if
函数,如果数据为 0,则应删除该行?例如:
If cell B1=0 then DELETE cell b1, and if cell B1=1 then UNCHANGED
答案1
尝试宏主要的():
Sub MAIN()
Dim rng As Range, v As Variant
Set rng = Range("B1")
v = 0
Call RowKiller(rng, v)
End Sub
Sub RowKiller(r As Range, v As Variant)
If r.Value = v Then
r.EntireRow.Delete
End If
End Sub