Results 1 to 4 of 4

Removing duplicates from the range urgent please?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Removing duplicates from the range urgent please?

    Hi All
    I'm using the below code to prevent/remove duplicate in my sheet.
    The problem with this code is, that it looks for duplicates in column A which is what I want but when ir finds the duplicate it removes data only from column A is the any way to modifiy existing code so that it will remove data from columns A,B,C,D?? I'm using userfrom to capture data and only need to look for duplicates in column A but if one found than everything from that row should be removed...
    Thank you for your help
    Dan
        Dim r As Range
    
    Dim ans As String
    
    Const myCol As Long = 1
    
    
    If Intersect(Target, Columns(myCol)) Is Nothing Then Exit Sub
    
    Application.EnableEvents = False
    
    For Each r In Intersect(Target, Columns(myCol))
    
       If Application.CountIf(Columns(myCol), r.Value) > 1 Then
    
       MsgBox (r.Value & " already exists")
       
           r.ClearContents
    
       End If
    
    Next
    
    Application.EnableEvents = True
    End Sub
    Last edited by ciapul12; 02-23-2014 at 04:18 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Removing set of email ids|| Desperate and urgent plea for guidance
    By Vasology in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-11-2013, 06:32 PM
  2. Combo Box Input Range - Removing Duplicates
    By ccooper in forum Excel General
    Replies: 1
    Last Post: 08-02-2012, 11:40 AM
  3. Replies: 6
    Last Post: 03-29-2012, 12:16 AM
  4. Replies: 2
    Last Post: 02-07-2005, 05:12 AM

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