ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete a whole row using a macro (https://www.excelbanter.com/excel-discussion-misc-queries/13729-delete-whole-row-using-macro.html)

LaurenceL

Delete a whole row using a macro
 
I am trying to set a macro up in Excel so that it will check a value in
column A and if the value equals 'abc' (or whatever other value), I want to
delete the row all together.
I haven't used VB in a long time, and I don't know how to get started... Any
help will be greatly appreciated.

Thank you

Bob Phillips


cLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = cLastRow to 1 Step -1
If Cells(i,"A").Value =, "abc" Then
Cells(i,"A").EntireRow.Delete
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"LaurenceL" wrote in message
...
I am trying to set a macro up in Excel so that it will check a value in
column A and if the value equals 'abc' (or whatever other value), I want

to
delete the row all together.
I haven't used VB in a long time, and I don't know how to get started...

Any
help will be greatly appreciated.

Thank you





All times are GMT +1. The time now is 01:30 AM.

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