Hello
I try writing simple code to my friend by copy item (MMMA) from column A:B to column D:E by ignore duplicates items and empty cell after show items in column D:E .
my proplem will show empty cells in column D:E
I posted the right result in columns D:E
this is the code
Sub copy_items()
Dim lr As Long
Dim i As Long
lr = Worksheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lr
With Worksheets("sheet1")
If Not IsEmpty(.Cells(i, 1)) And Not IsEmpty(.Cells(i, 2)) And .Cells(i, 1) = "MMMA" Then
.Cells(i, 4) = .Cells(i, 1): Cells(i, 5) = .Cells(i, 2)
End If
End With
Next
With Worksheets("sheet1")
.Range("$D:$E").RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
End With
End Sub
thanks