delete cells

  • Thread starter Thread starter lijia137
  • Start date Start date
L

lijia137

i have a worksheet with several columns, and i want to use one
specific colume as my reference, i.e. values under 100 in this column
as well as values/texts in the same rows should be deleted, basically
it's to delete a range of data based on certail value, is there a
way?
thanks a ton!
 
Assume the data is in column A.

Sub dltunder100()
Dim c As Range
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("A1:A" & lastRow)
If c.Value < 100 Then
c.EntireRow.Delete 'can be changed to a specific range
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top