spill-the-beans
Board Regular
- Joined
- Feb 7, 2013
- Messages
- 52
Hello everyone,
One of my datasheets by necessity ends up as about 25,000 rows long, but only about 40 of those rows have data in. The rest of the rows are empty.
If a row has data in, there will be data in every column on that row, for example if row 2 was not empty, there would be data in A, B, C . . . and all the way to the last column without missing cells along the row.
I need to copy those 40 rows without blank rows in between. At the moment, I have a macro that deletes blank rows, but it takes hours to run. I really don't think what I'm doing is the quickest way and I was wondering if anyone knows a better alternative.
This is the code that's being used at the moment:
Sub DeleteBlankARows()
Dim r As Long
For r = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(r, 1) = "" Then Rows(r).Delete
Next r
End Sub
One of my datasheets by necessity ends up as about 25,000 rows long, but only about 40 of those rows have data in. The rest of the rows are empty.
If a row has data in, there will be data in every column on that row, for example if row 2 was not empty, there would be data in A, B, C . . . and all the way to the last column without missing cells along the row.
I need to copy those 40 rows without blank rows in between. At the moment, I have a macro that deletes blank rows, but it takes hours to run. I really don't think what I'm doing is the quickest way and I was wondering if anyone knows a better alternative.
This is the code that's being used at the moment:
Sub DeleteBlankARows()
Dim r As Long
For r = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(r, 1) = "" Then Rows(r).Delete
Next r
End Sub