I've created a macro that formats an Excel worksheet that can vary in length from 100 rows to 500 rows. The code I'm using (Tek-Tips) dynamically resets the last row, but it fails to include the $EOF marker that my C program requires (see sample data). Does anyone know how this can be changed so that the $EOF row is included when the macro formats the data?
Sample data
6/28/03 C CCC MISW 524 (row 1)
6/23/03 C CCC OHSW 2885
6/24/03 C CCC OHSW 2288
.
.
6/26/03 C CCC IWSW 325
6/27/03 C CCC IWSW -54
6/28/03 C CCC IWSW 383
$EOF (row 500)
Code:
Sub CleanBlankRows()
Dim CurrentEndOfSheet As Integer, MyEndOfSheet As Integer
CurrentEndOfSheet = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
MyEndOfSheet = Range("A" & ActiveSheet.Rows.Count).End(xlUp).Row
Range("A" & MyEndOfSheet + 1 & ":A" & CurrentEndOfSheet).Rows.EntireRow.Delete
NewEndOfSheet = ActiveSheet.UsedRange.Rows.Count
End Sub
Sample data
6/28/03 C CCC MISW 524 (row 1)
6/23/03 C CCC OHSW 2885
6/24/03 C CCC OHSW 2288
.
.
6/26/03 C CCC IWSW 325
6/27/03 C CCC IWSW -54
6/28/03 C CCC IWSW 383
$EOF (row 500)