I am trying to delete Empty rows by using below code:
worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
The code above is working fine, but giving run time error '1004': No Cells were found.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The error handling helps when there are no blank cells.
SpecialCells(xlCellTypeBlanks)will always return an error if there are no cells like that so error handling is the only way (that I know of) to deal with it if you want to useSpecialCells(xlCellTypeBlanks).