ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete rows in a given range (https://www.excelbanter.com/excel-programming/436723-re-delete-rows-given-range.html)

Rick Rothstein

delete rows in a given range
 
I'm pretty sure this non-looping macro will do what you want (assuming your
values in Column C are constants and not formula results)...

Sub DeleteRows()
On Error Resume Next
Intersect(Columns("A").SpecialCells(xlCellTypeBlan ks).EntireRow, _
Columns("C").SpecialCells(xlCellTypeConstants).Ent ireRow).Delete
End Sub

If Column C contains formulas, not constants, then replace the
xlCellTypeConstants argument with xlCellTypeFormulas in the above code.

--
Rick (MVP - Excel)


"Wen" wrote in message
...
Anyone has a good sub to delete from a given range any row with blank
index cell?
For example, I have a table range with column A titled "Name" as index
column. I need a sub that deletes any row where column A is blank, but
say, column C has non-blank value. it is not the same as deleting all
blank rows in a range.
TIA.
Wen




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

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