b.hill2387
New Member
- Joined
- Mar 28, 2012
- Messages
- 38
I am trying to delete empty rows in the data sets that I import into excel. Sometimes the data sets have empty rows and sometimes they do not. The code below works in deleting empty rows if there are any, but if there are no empty rows to delete it comes up with a Run-time error 1004 saying "No cells were found" and highlights my second line of code. Is there a way to fix this? Thanks in advance.
Code:
Sheets("Comparison 1").Select
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Sheets("Comparison 2").Select
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete