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
7 years 33 weeks ago
8 years 19 weeks ago
8 years 31 weeks ago
8 years 34 weeks ago
8 years 35 weeks ago
8 years 40 weeks ago
8 years 48 weeks ago
8 years 49 weeks ago
8 years 49 weeks ago
8 years 49 weeks ago