Excel delete blanks help

Closed
ken - May 16, 2011 at 10:11 AM
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 - May 16, 2011 at 10:35 AM
Hello,
I have a macro to delete rows where if the cell in column c is blank as follows:

Columns("C:C").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete

I am getting an error because sometimes there are no blank cells in column C. Any ideas on how to write an IF statement to delete rows with cells in C blank and then continue on thru my macro?

Thanks


1 response

Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
May 16, 2011 at 10:35 AM
Insert Module & Paste It

Option Explicit

Sub deleteblankrows()


Application.ScreenUpdating = True
[C:C].AutoFilter Field:=1, Criteria1:="="
[C2:C65536].SpecialCells(xlVisible).EntireRow.Delete
If [C1] = "" Then [1:1].Delete
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True


End Sub
0