Hello,
I thought that this code might be useful:
This code goes through column A "(Lnn, 1)" and looks for those cells that are not in Date Format and deletes the entire row. I used it after importing a computer generated text file to Excel, which had redundant rows. The nice thing about this code is that it makes the file more compact and is customizable.Public Sub DeleteRowsNoDate()
lastRow = ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For lnn = lastRow To 1 Step -1
If Not IsDate(Worksheets("Sheet1").Cells(lnn, 1)) Then Rows(lnn).Delete
Next lnn
End Sub
The key is to change the "IsDate" to any other format, and the column to look for to (lnn, x), where x is the column number. A is 1, B is 2, etc.
Regards,
Ralfie
Bookmarks