VBA Question: IF value in M >0, set O="Delete"

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

Guest

In my worksheet I have several rows that I want to delete based on a flag
value from other calculations. What I need to do is set the value in column
O to "delete", for the corresponding row, IF the value in column M is >0.

Logic is like this:

IF M >0, then set O="Delete"

Can you help?

Thanks in advance!

Scott
 
Hi

You could use an Autofilter, to filter out the strictly positive values in
column M.

Then go to column O, select the whole column, hit F5 > Special... > visible
cells, hit Delete.
 
Scott,

Try something like this:

Sub test()
Dim c As Range
For Each c In Application.Intersect(ActiveSheet.UsedRange,
ActiveSheet.Range("M:M"))
If IsNumeric(c.Value) And c.Value > 0 Then
c.Offset(0, 2).Value = "delete"
End If
Next c
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