如何利用vba删除excel中A列含有“■”的单元格所在的行

2024-11-12 00:13:15
推荐回答(3个)
回答1:

Sub 删除包含固定文本单元的行或列()
Do Until Columns("A").Find("■*") Is Nothing
Columns("A").Find("■*").EntireRow.Resize(3).Delete
Loop
End Sub

回答2:

Sub 删除包含固定文本单元的行或列()

row=range("A65536").end(xlup).row
for i=row to 1 step -1
if range("A" &i) like "■*" then range("A" &i).resize(3,1).entirerow.delete
next
End Sub

回答3:

Sub 删除包含固定文本单元的行或列()
Dim i As Integer, j As Integer
With Range("a:a")
Do
i = .Find(what:="■*").Row
j = .Find(what:="■*").Column
Rows(i & ":" & i + 2).Delete
Loop Until .Find(what:="■*") Is Nothing
End With
End Sub

这样就能固定查找A列的了,并且删除三行