My lastcell and my last used row of data does not coincide.
How do I set my last cell to coincide with the last cell of actual data.
Column B has data in every row except row 1. None of the other columns have contiguous data from row 2 onwards.
There is no row including row 1 that is empty.
The data columns run up to column M
I have this code that I adapted from elsewhere but it does not seem to work - at least not consistently.
Please help
--Perry
Sub DelRowsBelowActualUsedRange()
'Reset used range to actual range by deleting unnecessary rows below last row of data
'No row below row 1 is completely empty
Dim rngCell As Range
For Each rngCell In Range("B2:B500")
If Application.CountA(rngCell.EntireRow) = 0 Then
rngCell.EntireRow.Delete
End If
Next rngCell
Range("D4").Select
ActiveWorkbook.Save
End Sub
Bookmarks