Auto Delete in Excel

Is it possible to accomplish the following scenario?

  1. G2 has an "X" in the cell
  2. Once my imported data causes H2 to have a higher value than J2, I would like for the "X" in G2 to be automatically deleted. Obviously, I have 100's of rows that need to be able to do that, not just row 2.

That would enhance the conditional formatting that I have in my spreadsheet.

Thanks.


  • Edited by TurkR 15 hours 44 minutes ago
June 12th, 2014 2:28pm

Hi,

Your required could be done via both of formula and macro via VBA.

Please try the formula and the macro:

Method1: =IF(H2>J2,"X","")

Method2:

Sub test()
Dim ws As Worksheet
Dim cell As Range
Set ws = ActiveWorkbook.ActiveSheet
For i = 1 To 100
    Set cell = ws.Range("G" & i)
    If cell.Offset(0, 1).Value > cell.Offset(0, 3).Value Then
        cell.Value = "x"
    Else
        cell.Value = ""
    End If
Next
End Sub

Regards,

George Zhao
TechNet Community Support




Free Windows Admin Tool Kit Click here and download it now
June 13th, 2014 1:38am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics