tlc53
Active Member
- Joined
- Jul 26, 2018
- Messages
- 399
Hi,
I have a very large amount of data that I would like to tidy up using a macro. I've sorted the data by the relevant columns and now I have rubbish data at the end, which I would like deleted.
Column A has a Ticket Number. Once column A stops having a ticket number, any data contained under columns A:K needs to be deleted.
In this particular case (and it will change depending on the months data) Cell A11721 is the last cell with a ticket number, so (in this case) all data contained in the next 24,104 rows, so A11722 : K35825 needs to be cleared or deleted.
I don't expect my data to exceed 50,000 rows so on that basis I tried the following VBA code..
However, it's not working and reporting error "Object Required". I'm not sure if this is the best way to do it though.
Any ideas please?
I have a very large amount of data that I would like to tidy up using a macro. I've sorted the data by the relevant columns and now I have rubbish data at the end, which I would like deleted.
Column A has a Ticket Number. Once column A stops having a ticket number, any data contained under columns A:K needs to be deleted.
In this particular case (and it will change depending on the months data) Cell A11721 is the last cell with a ticket number, so (in this case) all data contained in the next 24,104 rows, so A11722 : K35825 needs to be cleared or deleted.
I don't expect my data to exceed 50,000 rows so on that basis I tried the following VBA code..
Code:
Sub DeleteBlankRows()
Dim Cl As Range
For Each Cl In Sheet1.Range("A2:A50000")
Cl.EntireRow.Delete = IIf(Cl = 0, True, False)
Next Cl
End Sub
However, it's not working and reporting error "Object Required". I'm not sure if this is the best way to do it though.
Any ideas please?