PDA

View Full Version : Delete Empty Rows



Rasm
04-27-2011, 04:55 AM
This is what I use to delete empty rows - is there a way I can get it to skip the first 3 rows - I really like this one as it is very quick. I suppose I could put a fony value in A1:A3 - then set them = vbnullstring after (but I really dont want to do so).





ActiveSheet.Columns(1).SpecialCells(xlCellTypeBlan ks).EntireRow.Delete

Excel Fox
04-27-2011, 06:42 AM
Application.Intersect(ActiveSheet.Columns(1).Cells (4).Resize(Rows.Count - 4 + 1), ActiveSheet.Columns(1).SpecialCells(xlCellTypeBlan ks)).EntireRow.Delete

Excel Fox
04-27-2011, 06:46 AM
This would be more elegant though

ActiveSheet.Cells(4, 1).Resize(Rows.Count - 4 + 1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete

Excel Fox
04-27-2011, 07:17 AM
By the way, why do you want to delete the entire range all the way to the last row in the sheet? Shouldn't you be using a more dynamic one based on the last filled cell of the column?

Like


With ActiveSheet
.Range(.Cells(4, 1), .Cells(.Cells(.Rows.Count, 1).End(xlUp).Row, 1)).SpecialCells(xlCellTypeBlanks).EntireRow.Delet e
End With

Rasm
04-28-2011, 02:13 AM
My column A is a position column - so it always have a value - if the record is valid. So your answer is perfect - tyvm