Results 1 to 9 of 9

Trying to find duplicate, copy and paste certain unique values, and remove the duplicates

Threaded View

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    39

    Trying to find duplicate, copy and paste certain unique values, and remove the duplicates

    Hello, Thank you for your time and expertise in advance.
    I have a workbook that uses a macro to aggregate attendance data from several other workbooks - the workbook is attached. I would like to use the email address column to search for duplicates, copy and paste attendance information, and then delete the duplicate row (and repeat this several times for each email address).

    With the code I have come up, which may be considered beginner, I am getting this error:

    1. Error comes up saying "Object required" (in the section highlighted)
    I would really appreciate someone pointing me in the right direction (for me to change the code) or posting corrected code.

    Sub CombineDuplicateRecords1()
    Application.ScreenUpdating = False
    '
    
    Dim CurrentRow As Integer
    Dim Email As String
    Dim CheckColumn As Integer
    Dim Q As Integer
    Dim SearchRange As Range
    Dim FindRow As Range
    Dim RowofDuplicate As Integer
    
    
    With ThisWorkbook.Sheets("Memberlist & Attend 2014-2015").Activate
    
        CurrentRow = 6
        Email = Range("C" & CurrentRow).Value
        CheckColumn = 5
        Q = 1
        
        
    Do While Email <> ""
          
            Email = Range("C" & CurrentRow).Value
                                
           
                For Q = 1 To 5
                 Set SearchRange = Sheets("Memberlist & Attend 2014-2015").Columns("C:C").Find(what:=Email, After:=.Range("C" & CurrentRow), LookIn:=xlFormulas, Lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
                    If ActiveCell.Row = CurrentRow Then
                        Q = 6
                        Else
                        RowofDuplicate = ActiveCell.Row
                        ActiveSheet.Range(Cells(RowofDuplicate, 5), Cells(RowofDuplicate, 33)).Copy
                        ActiveSheet.Range(Cells(CurrentRow, 5), Cells(CurrentRow, 33)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True
                        ActiveSheet.Cells(RowofDuplicate, CheckColumn).EntireRow.Delete Shift:=xlUp
                    End If
                Next Q
    
            CurrentRow = CurrentRow + 1
            Email = Range("C" & CurrentRow).Value
            Q = 1
    
    Loop
    End With
    '
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    Last edited by adamstarr12; 06-23-2014 at 10:18 AM. Reason: Added sample data and updated error

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  2. [SOLVED] Find Duplicates and remove the duplicate entry comparing two columns
    By retrospikz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-04-2013, 03:17 AM
  3. [SOLVED] Unique Values Without Remove Duplicates
    By Camel in forum Excel General
    Replies: 25
    Last Post: 07-20-2012, 04:17 AM
  4. Replies: 1
    Last Post: 05-24-2011, 04:04 AM
  5. Macro to remove duplicates values and keep unique values bases on multiple criteria
    By Ricker090 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2011, 04:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1