Reputation: 69
I have an excel worksheet where I have sorted into date order and this leaves an awful lot of blanks at the bottom of the spreadsheet which I would like to delete but leave the final two. (the one at the very bottom is formatted blue to the height of 6 and the one just above is blank and also to the height of 6).
The data is stored from A5
to J
and varies in length - tab name is Date Order
Does anyone know of any VBA code that will help with this problem.
Any help would be greatly appreciated.
Upvotes: 0
Views: 319
Reputation: 69
This does the trick if anyone wants the code however it does not leave the last two rows does anyone know how to achieve this?
' This macro deletes all rows on the active worksheet
' that have no value in column A.
Dim iRow As Long
Dim LastRow As Long
LastRow = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1
For iRow = LastRow To 1 Step -1
If Cells(iRow, 1) = "" Then Rows(iRow).Delete
Next iRow
Upvotes: 1