How to find values between a range and delete

January 2017


How to find values between a range and delete




Issue


I don't know where to begin in writing this macro. If I have column J with values & I want to search for any values BETWEEN ranges of 1.00E+17 to 1.00E+38 and delete rows when it finds those values.

Solution


Try this macro:

Sub test()
Set MyRng = Range("A1:A20")
For Each cell In MyRng
    If cell.Value > 1E+17 And cell.Value < 1E+38 Then
    cell.EntireRow.Delete
        End If
    Next
End Sub



You might want to change the range and replace the < and > symbols by <= and >=.

Note


Solved by TrowaD

Related


Published by aakai1056. Latest update on November 5, 2010 at 03:10 AM by aakai1056.
This document, titled "How to find values between a range and delete," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).