delete last-line help.

  • Thread starter Thread starter Matthew Dyer
  • Start date Start date
M

Matthew Dyer

I have a code that will delete the last line of a spreadsheet -

Range("a65536").End(xlUp).Select
Selection.EntireRow.Delete

What I'd like it to do is look into that line, and if the value for
the cell in column A is MTD_AVG to delete the line, but if it is
anything else to leave the line intact. Help please?
 
With Cells(Rows.Count, 1).End(xlUp)
If InStr(1, .Value, "MTD_AVG", vbBinaryCompare) > 0 Then
.EntireRow.Delete
End If
End With
--
Jim Cone
Portland, Oregon USA
Review: http://www.contextures.com/excel-sort-addin.html

..
..
..

"Matthew Dyer" <[email protected]>
wrote in message
I have a code that will delete the last line of a spreadsheet -
Range("a65536").End(xlUp).Select
Selection.EntireRow.Delete

What I'd like it to do is look into that line, and if the value for
the cell in column A is MTD_AVG to delete the line, but if it is
anything else to leave the line intact. Help please?
 
With Cells(Rows.Count, 1).End(xlUp)
  If InStr(1, .Value, "MTD_AVG", vbBinaryCompare) > 0 Then
    .EntireRow.Delete
  End If
End With
--
Jim Cone
Portland, Oregon  USA
Review:  http://www.contextures.com/excel-sort-addin.html

.
.
.

"Matthew Dyer" <[email protected]>
wrote in message
I have a code that will delete the last line of a spreadsheet -
Range("a65536").End(xlUp).Select
Selection.EntireRow.Delete

What I'd like it to do is look into that line, and if the value for
the cell in column A is MTD_AVG to delete the line, but if it is
anything else to leave the line intact. Help please?

works PERFECTLY! Thanks for the quick response!
 
Back
Top