Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / May 2006

Tip: Looking for answers? Try searching our database.

Delete row containing all previous values.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mohd21uk - 10 May 2006 09:52 GMT
I have a column in a spreadsheet with repeated values for e.g  a name which
is repeated 5 times I would like to keep the last row containing this value
but delete all previous rows i.e in this example i would like to keep row
five containing the last occourence of this value and delete all previous
rows.
Don Guillett - 10 May 2006 13:57 GMT
try this

Sub deleledupsinpreviousrows()
For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) = Cells(i, 1) Then Rows(i - 1).Delete
Next
End Sub

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

>I have a column in a spreadsheet with repeated values for e.g  a name which
> is repeated 5 times I would like to keep the last row containing this
> value
> but delete all previous rows i.e in this example i would like to keep row
> five containing the last occourence of this value and delete all previous
> rows.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.