PDA

View Full Version : find and move the duplicate values in another sheet



maximbebi
02-19-2014, 07:55 AM
Hello,

I have a file with many values, distributed across multiple columns.

From sheet1 i want to find and move all the duplicate values in the sheet 2

and I need a macro,a code macro to work at the level of the sheets, Sheet1-Sheet2

I want to move cut/paste all values duplicates 2 times 3 times or how many times is found
from sheet1, in sheet2 the results to be made in columns A and B

in sheet 1 to remain single value, only the values themselves which didn't pair
I mean if a value is 2 times
to move the original value
but and double found

Thank you

patel
02-19-2014, 10:26 AM
Sub a()
Dim cell As Range
Set sh2 = Sheets(2)
Set Rng = Sheets(1).UsedRange
drow = 1
For Each cell In Rng
If Application.WorksheetFunction.CountIf(Rng, cell.Value) > 1 Then
sh2.Cells(drow, 1) = cell.Value
drow = drow + 1
cell.ClearContents
End If
Next
End Sub

maximbebi
02-19-2014, 10:45 AM
working code but does not take all values

p45cal
02-19-2014, 12:33 PM
For others, cross-posted wholesale:

http://www.excelguru.ca/forums/showthread.php?2692-find-and-move-the-duplicate-values-in-another-sheet
http://www.mrexcel.com/forum/excel-questions/758191-find-move-duplicate-values-another-sheet.html
http://windowssecrets.com/forums/showthread.php/159625-find-and-move-the-duplicate-values-in-another-sheet?p=941381#post941381
http://stackoverflow.com/questions/21828219/find-and-move-the-duplicate-values-in-another-sheet
http://www.excelforum.com/excel-programming-vba-macros/990180-find-and-move-the-duplicate-values-in-another-sheet.html
http://www.marshut.com/iqkqzr/find-and-move-the-duplicate-values-in-another-sheet.html
http://buradabuldum.blogspot.co.uk/2014/02/excel-macros-find-and-move-duplicate.html
http://chandoo.org/forum/threads/find-and-move-the-duplicate-values-in-another-sheet.14950/

For maximbebi, some light reading:
http://www.excelguru.ca/content.php?184-A-message-to-forum-cross-posters