k0st4din
02-23-2014, 09:38 PM
Hello everyone ,
I asked in another forum to make a macro and there helped me , but it turned out that it should be revised .
Then I wrote again, but so far no reply.
I would like to ask you if you can help me and adapt it slightly .
Macro searches the specified column matches and if you find them , delete their ranks. I asked if it could be done so as to preserve the idea of the macro (to make exactly the same ) but to delete the rows of A:X, because after that point (column ) I have written other things that are constant and have to be there. I would be very grateful if you help me.
Here is the link to my inquiry. (http://www.mrexcel.com/forum/excel-questions/758304-macro-compare-date-number-product.html)
Herre is macro:
Sub deldupe2()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1) 'Edit Sheet name
lr = sh.Cells(Rows.Count, 11).End(xlUp).Row
sh.UsedRange.Sort sh.Range("K1"), xlAscending, Header:=xlYes
For i = lr To 2 Step -1
If sh.Cells(i, 11).Value = sh.Cells(i - 1, 11).Value And _
sh.Cells(i, 7).Value = sh.Cells(i - 1, 7).Value And _
sh.Cells(i, 4).Value = sh.Cells(i - 1, 4).Value Then
Rows(i).Delete
End If
Next
End Sub
I asked in another forum to make a macro and there helped me , but it turned out that it should be revised .
Then I wrote again, but so far no reply.
I would like to ask you if you can help me and adapt it slightly .
Macro searches the specified column matches and if you find them , delete their ranks. I asked if it could be done so as to preserve the idea of the macro (to make exactly the same ) but to delete the rows of A:X, because after that point (column ) I have written other things that are constant and have to be there. I would be very grateful if you help me.
Here is the link to my inquiry. (http://www.mrexcel.com/forum/excel-questions/758304-macro-compare-date-number-product.html)
Herre is macro:
Sub deldupe2()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1) 'Edit Sheet name
lr = sh.Cells(Rows.Count, 11).End(xlUp).Row
sh.UsedRange.Sort sh.Range("K1"), xlAscending, Header:=xlYes
For i = lr To 2 Step -1
If sh.Cells(i, 11).Value = sh.Cells(i - 1, 11).Value And _
sh.Cells(i, 7).Value = sh.Cells(i - 1, 7).Value And _
sh.Cells(i, 4).Value = sh.Cells(i - 1, 4).Value Then
Rows(i).Delete
End If
Next
End Sub