Macro

Closed
cool - Aug 20, 2009 at 11:25 PM
 cool - Sep 10, 2009 at 02:46 AM
Hello,

I have a excel sheet. In that almost 500 datas exists. now i wanted to compare 2 conditions. If "C:C" column
is "4" and "F:F" is "6", then it has to delete entire row without blank row.

Eg: A B C D E F
1 2 4 4 5 6
2 2 2 2 2 2
3 4 4 0 0 6

In this example it has to delete row 1 and 3.

Please help me to solve.

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Aug 26, 2009 at 08:52 PM
use this macro

Sub test()
Dim j As Integer, k As Integer
j = Range("A1").End(xlDown).Row
'j is the last row
For k = j To 1 Step -1
If Cells(k, "c") = 4 And Cells(k, "f") = 6 Then
Cells(k, "c").EntireRow.Delete
End If
Next k
End Sub
0
Excellent Code sir, Thank You very much.
0