Solution to Find and move the duplicate values in another sheet

Find and move the duplicate values in another sheet....
Before using the below mentioned code please use conditional formatting with =COUNTIF($A$1:A1,A1)>1 formula there after this code will work.
Hope it will help you...
Sub test()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim rng As Range
Dim cell As Range
Set rng = Application.InputBox("Select a range", Type:=8)
j = 1
For Each cell In rng
If cell.DisplayFormat.Interior.Color <> 16777215 Then
rcount = Sheets(2).Cells(Rows.Count, 1).End(xlUp).Row
cell.Cut Destination:=Sheets(2).Range("A" & j)
j = j + 1
End If
Next
rng.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Thanks & regards,
Vikas Verma
Attachment | Size |
---|---|
Find and move the duplicate values in another sheet.xlsm | 18.27 KB |
Recent comments
6 years 3 weeks ago
6 years 41 weeks ago
7 years 1 week ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 10 weeks ago
7 years 18 weeks ago
7 years 19 weeks ago
7 years 19 weeks ago
7 years 19 weeks ago