deleting cells

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

lijia137

I have a workbook that i need to delete some cells automatically after
sorting. The rule is to use one specific column (say column O) as
reference, i.e. values<100 in this column, together with things in the
same rows should be deleted, basically it's to delete a range of data?
how should i write it? Thanks a ton!
 
One way.... Scan the entire rows to perform test from bottom to top.,
testing each column value and deleting entire row. Something like

Sub RemRows()
Dim xr As Long
With ActiveSheet
For xr = 100 To 1 Step -1
If .Cells(xr, "O") < 100 Then Rows(xr).EntireRow.Delete
Next xr
End With

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