如何使用VBA 根据单元格里内容进行删除单元格

2024-11-08 11:30:36
推荐回答(2个)
回答(1):

'给个代码,不过,你给的题里的单词拼写前后不一样,我在程序中是查找“GOOSE”如果要改成“GOSSE”请自己修改一下,特此提醒。代码如下:
Sub 删除()
x = Range("L65536").End(xlUp).Row
For i = 1 To x
If UCase(Cells(i, 12)) = "GOOSE" Then
Cells(i, 12).Delete 3
i = i - 1
End If
Next i
End Sub

回答(2):

Sub 删除L列特定行()
Application.ScreenUpdating = False
Dim i As Long, b As Long
b = Range("l65536").End(xlUp).Row
For i = b To 1 Step -1
If Range("l" & i) = "GOOSE" Then
Range("l" & i).EntireRow.Delete
End If
Next i
Application.ScreenUpdating = True
End Sub