View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Macro to delete last entry of a column

Sorry, I mis-read your post........this one will delete just the last two
entries in column A, rather than the entire rows.

Sub DeleteBottom2Rows()
ActiveSheet.Select
Range("a65000").Select
Selection.End(xlUp).Select
Selection.ClearContents
Selection.Offset(-1, 0).ClearContents
End Sub

Vaya con Dios,
Chuck, CABGx3




"clr" wrote in message
...
Maybe this

Sub DeleteBottom2Rows()
ActiveSheet.Select
Range("a65000").Select
Selection.End(xlUp).Select
Selection.EntireRow.Delete
Selection.Offset(-1, 0).EntireRow.Delete
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Mel" wrote in message
...
I want to delete the last 2 entries of column of data in excel 2007. The
column length varies each time I want to run the macro. I've tried
recording
a macro using the 'ctl down' shortcut then deleting the last two entries.
However, when I run the macro on a different data set it doesn't delete
the
last entries but deletes the data in the rows that was recorded in the
original macro.

Please could you advise me on the line of code I need to refer to the
last
two entries of a column of any length.

Thank you!