Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find and copy duplicates to new worksheet
Hi,
I have a macro to find and mark duplicated values in a sorted column of data as follows: Sub FindDuplicates() Dim check As String Dim colName As String Dim A As Integer colName = "B" Range(colName & 1).Select 'loop through first 100 rows For A = 1 To 100 Range(colName & A).Activate If ActiveCell.Value = check Then ActiveCell.Font.Bold = True Else End If check = ActiveCell.Value Next A End Sub I'd like to copy the values from the marked cells (and also the matching value from the cell above, if possible) to a new worksheet. I can get the first hit okay by adding this code to the loop: ActiveCell.EntireRow.Copy Sheets(2).Select ActiveSheet.Paste .... but this breaks things - presumably because I lose the active cell? Any suggestions on how I should approach this? many thanks, Del. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare worksheets for duplicates and copy data to 1st worksheet | Excel Worksheet Functions | |||
Find Duplicates and Move to New Worksheet | Excel Worksheet Functions | |||
how do i find and delete duplicates in excel worksheet? | Excel Discussion (Misc queries) | |||
why can't excel do a simple find and copy row from a worksheet to. | Excel Worksheet Functions | |||
Auto find a specific row and copy it to another worksheet | Excel Programming |