ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort/Duplicate Help (https://www.excelbanter.com/excel-programming/366676-sort-duplicate-help.html)

nascarjc

Sort/Duplicate Help
 

Hello All,
This is what I am trying to do. I am new at this and have been trying
for a couple of weeks.
Truck # Date Checked Engine #
36481 6/28/06 3cs26898
36498 6/26/06 3cs27391
36507 7/5/06 3cs27750
36526 6/26/06 3cs28760
36526 6/28/06 3cs28760
36539 6/26/06 3cs28972
36540 7/5/06 3cs28990
36550 6/28/06 3cs28983
36552 6/26/06 3cs28920
36553 6/28/06 3cs28921
36558 7/5/06 3cs28595

I want to sort column A then include B & C (expand selection) I think
it says, then check for duplicate Truck #'s and delete or remove the
duplicate truck # row.
Hope this makes sense.
Any help would be appreicated. Thx in advance
James


--
nascarjc
------------------------------------------------------------------------
nascarjc's Profile: http://www.excelforum.com/member.php...o&userid=31002
View this thread: http://www.excelforum.com/showthread...hreadid=559639


Tom Ogilvy

Sort/Duplicate Help
 
Sub FixData()
Dim lastrow as Long, i as Long
Range(A:C).Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow - 1 to 2 step - 1
if cells(i,1) = cells(i+1,1) then
rows(i).Delete
end if
Next
End Sub

Test it on a copy of your data.

--
Regards,
Tom Ogilvy

"nascarjc" wrote in
message ...

Hello All,
This is what I am trying to do. I am new at this and have been trying
for a couple of weeks.
Truck # Date Checked Engine #
36481 6/28/06 3cs26898
36498 6/26/06 3cs27391
36507 7/5/06 3cs27750
36526 6/26/06 3cs28760
36526 6/28/06 3cs28760
36539 6/26/06 3cs28972
36540 7/5/06 3cs28990
36550 6/28/06 3cs28983
36552 6/26/06 3cs28920
36553 6/28/06 3cs28921
36558 7/5/06 3cs28595

I want to sort column A then include B & C (expand selection) I think
it says, then check for duplicate Truck #'s and delete or remove the
duplicate truck # row.
Hope this makes sense.
Any help would be appreicated. Thx in advance
James


--
nascarjc
------------------------------------------------------------------------
nascarjc's Profile:
http://www.excelforum.com/member.php...o&userid=31002
View this thread: http://www.excelforum.com/showthread...hreadid=559639




nascarjc[_2_]

Sort/Duplicate Help
 

Hi Tom,
Thanks for the help. I will give it a try and get back to you on ho
it went.
Jame

--
nascarj
-----------------------------------------------------------------------
nascarjc's Profile: http://www.excelforum.com/member.php...fo&userid=3100
View this thread: http://www.excelforum.com/showthread.php?threadid=55963


nascarjc[_3_]

Sort/Duplicate Help
 

Hello Tom,
I tried the code for the sort and works great and I like how it does
it. One thing maybe I should have mentioned before also. When it
deletes the duplicates, it erases all the codes I have in it. The page
I am sorting and deleting the duplicates, it is copying data from
another page.
What you gave me though is great, I wish I could come up with code that
fast. Thanks for your help it is much appreicated. If you need my
codes I would gladly put it on also.
James


--
nascarjc
------------------------------------------------------------------------
nascarjc's Profile: http://www.excelforum.com/member.php...o&userid=31002
View this thread: http://www.excelforum.com/showthread...hreadid=559639



All times are GMT +1. The time now is 12:08 AM.

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