ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CAN ANYBODY PLEASE AMEND MY MACRO (https://www.excelbanter.com/excel-programming/409761-can-anybody-please-amend-my-macro.html)

K[_2_]

CAN ANYBODY PLEASE AMEND MY MACRO
 
Hi, I have data in sheet (see below)

ROW * * A * * * * * E * * * *F-----col
1 * * * * *3080 * * G16 * * 11
2 * * * * * *500 * * G16 * * 12
3 * * * * -3080 * * G16 * * 11
4 * * * * *3080 * * G16 * * 11
5 * * * * -3080 * * G16 * * 11
6 * * * * -3080 * * G16 * * 12
7 * * * * *5040 * * G34 * * 11
8 * * * *52590 * * G34 * * 12
9 * * * * -5040 * * G34 * * 11
10 * * * *5040 * * G34 * * 11
11 * * * -5040 * * G34 * * 11
12 * * * -5040 * * G34 * * 12

The macro below work perfectly fine the only thing I want to amend in
the macro below that at the moment macro check column "E" and then see
column "A" for DR and CR figures and when values in column "E" cells
match and have DR and CR figures in column "A" cells then it delete
the DR and CR rows. I want to add column "F" as well in macro below
that it should check column E & F and when values are same in both
columns like in above table in cell "E1" i have "G16" in cell "F1" i
have "11" and same values i have in cells "E3, E4 , E5 and F3 , F4 ,
F5" then it should delete the DR and CR figures row in column "A".
how can i add column "F" in macro below. any body can please help.

Sub DELDRCR()
* * HdgRow = 5
* * i1 = Cells(Rows.Count, "E").End(xlUp).Row
* * While i1 = HdgRow + 2
* * * * j1 = 1
* * * * While i1 - j1 HdgRow And Cells(i1, "E").Value = Cells(i1 -
j1, "E").Value
* * * * * * If -Cells(i1, "A") = Cells(i1 - j1, "A") _
* * * * * * And IsNumeric(Cells(i1, "D")) Then
* * * * * * * * Rows(i1).DELETE
* * * * * * * * Rows(i1 - j1).DELETE
* * * * * * * * i1 = i1 - 2
* * * * * * * * j1 = 0
* * * * * * End If
* * * * * * j1 = j1 + 1
* * * * Wend
* * * * i1 = i1 - 1
* * Wend
End Sub


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com