Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Removing Duplicates and Pasting

Hi, the following code is meant to loop through column E - 100 Clients (many
duplicated) and paste each client (without duplicates) to Column B of current
wks

Not quite working but i think im close - help is greatly appreciated, thks

Sub rev()

Dim LastRow As Long
Dim i, j As Long
LastRow = Worksheets("Jobs").Cells(Rows.Count, 5).End(xlUp).Row
j = 3
For i = LastRow - 1 To 1 Step -1
If Worksheets("Jobs").Cells(i + 1, 5).Value <
Worksheets("Jobs").Cells(i, 5).Value Then
Worksheets("Jobs").Cells(i + 1, 5).Copy Destination:=Cells(j, 2)
j = j + 1
End If
Next

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Removing Duplicates and Pasting

Sub rev()

Dim LastRow As Long
Dim i, j As Long
LastRow = Worksheets("Jobs").Cells _
(Rows.Count, 5).End(xlUp).Row
j = 3
For i = 1 To LastRow
If Worksheets("Jobs").Cells(i, 5).Value < _
Worksheets("Jobs").Cells(i + 1, 5).Value Then
Worksheets("Jobs").Cells(i, 5).Copy _
Destination:=Cells(j, 2)
j = j + 1
End If
Next
End Sub

worked fine if Column E on Jobs is sorted.

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Hi, the following code is meant to loop through column E - 100 Clients

(many
duplicated) and paste each client (without duplicates) to Column B of

current
wks

Not quite working but i think im close - help is greatly appreciated, thks

Sub rev()

Dim LastRow As Long
Dim i, j As Long
LastRow = Worksheets("Jobs").Cells(Rows.Count, 5).End(xlUp).Row
j = 3
For i = LastRow - 1 To 1 Step -1
If Worksheets("Jobs").Cells(i + 1, 5).Value <
Worksheets("Jobs").Cells(i, 5).Value Then
Worksheets("Jobs").Cells(i + 1, 5).Copy Destination:=Cells(j, 2)
j = j + 1
End If
Next

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Removing Duplicates and Pasting

Thank You Tom

"Tom Ogilvy" wrote:

Sub rev()

Dim LastRow As Long
Dim i, j As Long
LastRow = Worksheets("Jobs").Cells _
(Rows.Count, 5).End(xlUp).Row
j = 3
For i = 1 To LastRow
If Worksheets("Jobs").Cells(i, 5).Value < _
Worksheets("Jobs").Cells(i + 1, 5).Value Then
Worksheets("Jobs").Cells(i, 5).Copy _
Destination:=Cells(j, 2)
j = j + 1
End If
Next
End Sub

worked fine if Column E on Jobs is sorted.

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Hi, the following code is meant to loop through column E - 100 Clients

(many
duplicated) and paste each client (without duplicates) to Column B of

current
wks

Not quite working but i think im close - help is greatly appreciated, thks

Sub rev()

Dim LastRow As Long
Dim i, j As Long
LastRow = Worksheets("Jobs").Cells(Rows.Count, 5).End(xlUp).Row
j = 3
For i = LastRow - 1 To 1 Step -1
If Worksheets("Jobs").Cells(i + 1, 5).Value <
Worksheets("Jobs").Cells(i, 5).Value Then
Worksheets("Jobs").Cells(i + 1, 5).Copy Destination:=Cells(j, 2)
j = j + 1
End If
Next

End Sub





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Duplicates Help Scott Excel Discussion (Misc queries) 6 May 5th 09 03:58 AM
Removing duplicates Tdp Excel Discussion (Misc queries) 6 November 27th 08 12:33 AM
Removing Duplicates Danielle Excel Worksheet Functions 5 March 10th 06 07:56 PM
removing duplicates robhargreaves Excel Discussion (Misc queries) 1 July 24th 05 12:35 AM
removing duplicates marina madeleine Excel Programming 0 September 15th 04 06:39 PM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"