Results 1 to 3 of 3

Prevent Duplicate entries in multiple column from VBA Userform

Threaded View

  1. #1
    Registered User
    Join Date
    07-10-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    33

    Prevent Duplicate entries in multiple column from VBA Userform

    Dear Team,

    I have a vba userform which enters data into multiple sheets. For two comboboxes, there can be "X" combinations like as follows:

    Column B Column C
    John Red
    John Black
    Michael Red
    Michael Black

    I want to prevent duplicate entries into columns. Currently I am using following code but it doesn't allow me to add multiple combinations. e.g. It won't allow me to add "Michael Red" if I have added "John Red" earlier in sheet.

    With ws
            If Not (WorksheetFunction.CountIf(ws.Range("D:D"), ComboBox6.Value) > 0 And WorksheetFunction.CountIf(ws.Range("E:E"), ComboBox3.Value) > 0) Then
    
                   
            .Cells(emptyRow, 1).Value = ComboBox7.Value
            .Cells(emptyRow, 2).Value = ComboBox8.Value
            .Cells(emptyRow, 3).Value = ComboBox9.Value
            .Cells(emptyRow, 4).Value = ComboBox6.Value
            .Cells(emptyRow, 5).Value = ComboBox3.Value
            .Cells(emptyRow, 6).Value = TextBox1.Value
            Response3 = MsgBox("Do you want to add more data", vbYesNo)
                    If Response3 = vbYes Then
                        ComboBox3.Value = Null
                        ComboBox6.Value = Null
                        TextBox1.Value = Null
                    Else
                        End If
        
            
            Else
                MsgBox ("Warning:Duplicate Entries Found. Please edit existing entries")
            End If
    
          End With
    End If
    Please help for this query.
    Last edited by excel_126; 12-17-2014 at 03:08 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Prevent duplicate entry in a userform by matching record to multiple columns.
    By rsbuslon in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-05-2023, 07:44 PM
  2. How To Prevent Duplicate URL Entries in the Cell in a Column?
    By kalucharan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-23-2014, 03:54 AM
  3. Need a real time macro to prevent the duplicate entries between multiple worksheets
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2013, 07:07 AM
  4. Replies: 0
    Last Post: 06-14-2012, 12:38 PM
  5. [SOLVED] Prevent duplicate entries
    By Teri in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-03-2005, 10:06 PM

Tags for this Thread

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