Excel delete blanks help

Closed
Report
-
Posts
138
Registration date
Thursday January 21, 2010
Status
Member
Last seen
May 8, 2019
-
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 reply

Posts
138
Registration date
Thursday January 21, 2010
Status
Member
Last seen
May 8, 2019
7
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