What I have are two columns A and B and for instant, some cells from row 1-50 are filled with numbers. I'd like to delete all rows in which both cells of column A and B are empty in those rows.
The code I found below only find empty cells in Column A then delete the entire rows. However, if cell in Column B is filled but empty in Column A, that row also gets deleted. (which I don't want this to happen)
Could anyone help me improve this code so that only when both cells in A and B are empty, the rows get deleted. Other rows remain the same if either cell of column A and B is filled.
Thanks in advance!
Sub deleteblankrows()
Application.ScreenUpdating = True
[a:a].AutoFilter Field:=1, Criteria1:="="
[a2:a65536].SpecialCells(xlVisible).EntireRow.Delete
If [a1] = "" Then [1:1].Delete
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
The code I found below only find empty cells in Column A then delete the entire rows. However, if cell in Column B is filled but empty in Column A, that row also gets deleted. (which I don't want this to happen)
Could anyone help me improve this code so that only when both cells in A and B are empty, the rows get deleted. Other rows remain the same if either cell of column A and B is filled.
Thanks in advance!
Sub deleteblankrows()
Application.ScreenUpdating = True
[a:a].AutoFilter Field:=1, Criteria1:="="
[a2:a65536].SpecialCells(xlVisible).EntireRow.Delete
If [a1] = "" Then [1:1].Delete
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub