View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default End (xlDown) question

I made i small mistake

LastRow = Range("J2").End(xlDown).Row
Rows((LastRow - 2) & ":" & LastRow).Delete

If there arre blank cells in column J then use this

LastRow = Range("J" & Rows.Count).End(xlup).Row
Rows((LastRow - 2) & ":" & LastRow).Delete


"Lotto" wrote:

I want to go to the end of column J, move up two rows, and delete the
last three rows. I'm just not sure how to get the delete range to
vary as I need it to. See code below:

Range("J2").Select
Selection.End(xlDown).Offset(-2, 0).Select
Rows("160:162").Select
Selection.Delete Shift:=xlUp
End Sub

Thanks in advance for your help!