ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a cell then delete the row (https://www.excelbanter.com/excel-programming/272847-re-find-cell-then-delete-row.html)

Ron de Bruin

Find a cell then delete the row
 
One way for column A

Sub test()
Dim Rng As Range
Dim FindString As String
Dim RngFound As Boolean
FindString = "BASE"
Application.ScreenUpdating = False
Do
Set Rng = Range("A:A").Find(What:=FindString, LookAt:=xlWhole)
If Not Rng Is Nothing Then Rng.EntireRow.Delete: RngFound = True
Loop While Not (Rng Is Nothing)

Application.ScreenUpdating = True
If Not RngFound Then MsgBox "No " & FindString & " entries were found"
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jessi" wrote in message om...
I'm very new to writing code of any kind and I don't really know where
to start with this.

I want to find a cell (I always know the column) and then delete the
whole row.

This is what I have that doesn't work at all:



Sub FindBASE()

' This should delete the BASE row

If ActiveSheet.Range("A1:A100").Value = "BASE" Then
ActiveCell.EntireRow.Delete
End If

End Sub





All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com