PLEASE CAN ANY BODY HELP

K

K

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
 
K

K

You've posted this 4 times now.....and I already gave you some code
that will work in this thread;

http://groups.google.co.uk/group/microsoft.public.excel.programming/b...

And if you want to adapt the above you need to change this line....

While i1 - j1 > HdgRow And Cells(i1, "E").Value = Cells(i1 - j1,
"E").Value

and add;

And And Cells(i1, "F").Value = Cells(i1 - j1, "F").Value

Hi anon I just have few questions about your code so I can better
understand how it works. Can you please give me little bit
explaination if you don’t mind

1 - "I = 1" what this recommend
2 - "J = 500" what this recommend
3 - "For Each C In ActiveSheet.Range("H6:H17") " how can I change
this range to H6 to the last value cell in column H
4 - "C1 = C.Offset(0, 1).Value" which column this code is
recommending I or J
5 - "C2 = C.Offset(0, 2).Value" which column this code is
recommending J or K
6 - For J = 6 To 17 how can I change this row change from 6 to last
value cell row in column H
 

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

Top