Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default copy duplicate rows to new sheet in WB

I'm trying to get this code to identify duplicate numbers in WS "All Records"
in column B and copy the entire row for any duplicates found to a new sheet
in the workbook called "Duplicates". I appreciate your help, thank you.

Dim rng As Range, cell As Range

Dim i As Long, sh As Worksheet
With Worksheets("All Records")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1

Set sh = Worksheets("Duplicates")
For Each cell In rng
If UCase(Trim(cell.Value)) = "4-$" Or _
UCase(Trim(cell.Value)) = "CNO-$" Then
If UCase(Trim(cell.Offset(0, 1).Value)) = _
"GESA CC" Then
cell.EntireRow.Copy sh.Cells(i, 1)
i = i + 1

End If

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
Copy Duplicate Rows to Userform Santhosh Excel Programming 0 April 24th 06 06:15 AM
Move data from on sheet to another keep duplicate rows mrdata[_10_] Excel Programming 4 March 10th 06 11:53 PM
Macro to copy duplicate rows (not delete) [email protected] Excel Programming 1 April 19th 05 12:30 PM
Macro - to copy duplicate rows to another sheet [email protected] Excel Worksheet Functions 2 April 19th 05 01:53 AM
Can excel remove the duplicate rows in a spread sheet? Robert Moritzky Excel Programming 2 October 3rd 04 12:02 AM


All times are GMT +1. The time now is 11:48 PM.

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"