+ Reply to Thread
Results 1 to 13 of 13

delete duplicate rows, delete empty rows

Hybrid View

loade delete duplicate rows, delete... 05-02-2012, 05:07 AM
jraj1106 Re: delete duplicate rows,... 05-02-2012, 05:10 AM
tom1977 Re: delete duplicate rows,... 05-02-2012, 05:21 AM
bonny24tycoon Re: delete duplicate rows,... 05-02-2012, 05:45 AM
arlu1201 Re: delete duplicate rows,... 05-02-2012, 07:26 AM
loade Re: delete duplicate rows,... 05-02-2012, 07:42 AM
arlu1201 Re: delete duplicate rows,... 05-02-2012, 08:17 AM
loade Re: delete duplicate rows,... 05-02-2012, 11:23 AM
arlu1201 Re: delete duplicate rows,... 05-02-2012, 11:25 AM
loade Re: delete duplicate rows,... 05-02-2012, 01:45 PM
arlu1201 Re: delete duplicate rows,... 05-02-2012, 02:21 PM
Nrowell92 Re: delete duplicate rows,... 05-02-2012, 03:35 PM
loade Re: delete duplicate rows,... 05-03-2012, 05:42 AM
  1. #1
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: delete duplicate rows, delete empty rows

    So even if a file has 20 columns of data, you want all 20 columns to be compared to each other for duplicates?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  2. #2
    Registered User
    Join Date
    04-30-2012
    Location
    Massachusetts, US
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: delete duplicate rows, delete empty rows

    This is the code I usually use. It asks which column to check for duplicates and blanks.

    Sub DeleteDuplicates()
    Dim colbox As String
    colbox = InputBox(Prompt:="Column to search for duplicates:", Title:="Column", Default:="A")
    colstring = colbox & ":" & colbox
    checkrow = 2
    
    Application.ScreenUpdating = False
    
    Do Until checkrow = lastrow
    
    lastrow = ActiveSheet.UsedRange.Rows.Count
    
    matchcheck = Application.CountIf(Range(colstring), Cells(checkrow, colbox))
        
        If matchcheck > 1 Then
        Cells(checkrow, colbox).EntireRow.Delete
        ElseIf Cells(checkrow, colbox) = "" Then
        Cells(checkrow, colbox).EntireRow.Delete
        
        Else
        checkrow = checkrow + 1
    
    End If
    
    Loop
    
    Application.ScreenUpdating = True
    
    MsgBox ("Done deleting duplicates.")
    
    End Sub
    Not the most efficient or best way at all but I personally like it. Good Luck

  3. #3
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: delete duplicate rows, delete empty rows

    Quote Originally Posted by arlu1201 View Post
    So even if a file has 20 columns of data, you want all 20 columns to be compared to each other for duplicates?
    regardless of the number of columns, data will be considered as rows only

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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