The reason you are skipping one, is because your first line
Selection.End(xlDown).Offset(1, 0).Select
selects the first blank cell as a result of using Offset, BUT, you then go and repeat that offset
in your next line:-
ActiveCell.Offset(1, 0).EntireRow.Delete
which will delete the line that is offset 1 row from the blank cell you have already selected (ie
the blank row selected in the first line of code). This means that you have in effect, offset
twice, and as Dave said, skipped the first blank row.
Just decide how many blank rows you need to delete after your last piece of data, whether or not
you want to delete the first blank line after your data as well, and then adjust Dave's line of
code:-
If you do want to delete that first blank line, then make the offset 1, if you don't make the
offset 2. Then just amend the 15 to be the actual number of rows you want to delete in total.
range("d2").end(xldown).offset(1,0).resize(15).entirerow.delete will delete 15 rows from and
including the first blank line after your data.
range("d2").end(xldown).offset(1,0).resize(16).entirerow.delete will delete 16 rows from and
including the first blank line after your data.
range("d2").end(xldown).offset(2,0).resize(15).entirerow.delete will delete 15 rows from and
including the line AFTER the first blank line in your data.
--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP
----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------
slappy54 said:
I didn't know I was skipping one blank row. I guess I need to delete the
next sixteen rows from the last value in the d column.
I appreciate your help.
Mike