ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro needed to fill down base on condition (https://www.excelbanter.com/excel-programming/426659-macro-needed-fill-down-base-condition.html)

MARTINEZ_PEDRO

macro needed to fill down base on condition
 

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|
+-------------------------------------------------------------------+

--
MARTINEZ_PEDRO
------------------------------------------------------------------------
MARTINEZ_PEDRO's Profile: http://www.thecodecage.com/forumz/member.php?userid=207
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=84306


joel

macro needed to fill down base on condition
 
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


"MARTINEZ_PEDRO" wrote:


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 dont 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|
+-------------------------------------------------------------------+

--
MARTINEZ_PEDRO
------------------------------------------------------------------------
MARTINEZ_PEDRO's Profile: http://www.thecodecage.com/forumz/member.php?userid=207
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=84306



MARTINEZ_PEDRO[_2_]

[SOLVED]: macro needed to fill down base on condition
 

THANK YOU JOEL the code works perfectly appreciate
:Bgr


--
MARTINEZ_PEDRO
------------------------------------------------------------------------
MARTINEZ_PEDRO's Profile: http://www.thecodecage.com/forumz/member.php?userid=207
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=84306



All times are GMT +1. The time now is 04:03 AM.

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