Link to home
Start Free TrialLog in
Avatar of willie108
willie108

asked on

delete cells based on value

I thought the attached macro would delete rows based on the values of a column of cells that I have preselected but it seems to delete far more than it should.  I want it to delete only those cells that have dates before March 1 2012. March1 has the julian value of about 41000.
Any suggestions on a modification?
Thanks.

Sub Deleteit()
Dim c As Range
For Each c In Selection
If c.Value = Range("$A$1").Value < 41000 Then c.EntireRow.Delete
Next
End Sub

Open in new window

Sub Deleteit()
Dim c As Range
For Each c In Selection
If c.Value = Range("$A$1").Value < 41000 Then c.EntireRow.Delete
Next
End Sub

Open in new window

Deleted by SouthMod, no points refunded:  8/22/2012 4:32:37 AM
Duplicate: https://www.experts-exchange.com/questions/27837464/clear-entries-and-delete-row.html
RA: https://www.experts-exchange.com/R_10146.html
ASKER CERTIFIED SOLUTION
Avatar of www_exacto_dk
www_exacto_dk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of willie108
willie108

ASKER

Thanks all.