macro needed to fill down base on condition

M

MARTINEZ_PEDRO

I have accounts that I need to compare to see if they exist on my system
the account that has a listed date, exist on my system then if I can
fill the dates in the accounts the match then I will be able to delete
the other accounts that don’t have a date see attach file for more
understanding
thankyou all for any help provided


+-------------------------------------------------------------------+
|Filename: SAMPLE.xls |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=105|
+-------------------------------------------------------------------+
 
J

joel

Sub Removeduplicates()

RowCount = 2
Do While Range("B" & RowCount) <> ""
If Range("A" & RowCount) = "" Then
'put x on rows to delete
Range("E" & RowCount) = "X"

Else
If Range("B" & RowCount) = _
Range("B" & (RowCount + 1)) Then

Range("A" & RowCount).Copy _
Destination:=Range("A" & (RowCount + 1))

End If
End If

RowCount = RowCount + 1
Loop

'sort to bring x's to top of worksheet
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Set SortRange = Rows("1:" & LastRow)
SortRange.Sort _
key1:=Range("E1"), _
order1:=xlAscending, _
header:=xlYes

LastRow = Range("E2").End(xlDown).Row
Rows("2:" & LastRow).Delete
End Sub
 

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