Select all cells in a range with a certain numerical value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a column with numbers in it. I want to select all cells with a
certain value, say 1, so that I may delete those cells. It's the method of
selecting the cells I can't figure out (I know how to delete them). Have
fooled around with SpecialCells and Find with no luck. Thanks much.
 
Hi
one way to delete them:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow To 1 Step -1
If Cells(row_index, "A").Value =1 then
Cells(row_index, "A").clearcontents
End If
Next
Application.ScreenUpdating = True
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