I have the following piece of code in an Excel 2002 macro. What it basically does is clear out any data that goes past the last row of records, thus basically clearing out in summary values.
The issue I have is - if a file does not have summary values - it clears out my last of row of data, which is needed. I hope to adjust my current code so I do not lose that last line?
The issue I have is - if a file does not have summary values - it clears out my last of row of data, which is needed. I hope to adjust my current code so I do not lose that last line?
Code:
Sub FindLastRow()
Dim LastRow As Long
Dim wlast As Integer
LastRow = Cells(Cells.Rows.Count, "a").End(xlUp).Offset(1).Row
wlast = LastRow
Range("a" & LastRow).Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
End Sub