+ Reply to Thread
Results 1 to 5 of 5

userform stops duplicates entering data sheet

  1. #1
    Registered User
    Join Date
    01-05-2023
    Location
    uk
    MS-Off Ver
    11
    Posts
    24

    userform stops duplicates entering data sheet

    can someone please help me

    textbox29 - textbox40 are recording reference numbers, but i cant have the same reference number appear in any of my columns once the data has been transferred. each textbox is on one multi page on my userform. so for example textbox29 has REF123 and this isnt already recorded this will enter, if i then add a new booking and textbox29 is REF456 and then textbox30 is REF123 this will flag as a duplicate as this was already recorded in a different column on the data enter sheet.

    multi page.
    textbox29 this data goes to columnD
    textbox30 this data goes to columnE
    textbox31 this data goes to columnF
    textbox32 this data goes to columnG
    textbox33 this data goes to columnH
    textbox34 this data goes to columnI
    textbox35 this data goes to columnJ
    textbox36 this data goes to columnK
    textbox37 this data goes to columnL
    textbox38 this data goes to columnM
    textbox39 this data goes to columnN
    textbox40 this data goes to columnO

    this is the code i have but will only look up textbox29 in column D,

    'this code was added when i click the command button on the userform to insert the data to check for the duplicate

    Private Sub MAKEBOOKING_Click()
    Dim a As Long, x As Long
    a = Application.WorksheetFunction.CountIf(Sheet1.Range("D:D"), Me.TextBox29.Text)
    x = Application.WorksheetFunction.CountA(Sheet1.Range("D:D"))
    If Me.TextBox29 <> "" And a = 0 Then
    Sheet1.Range("a" & x).Value = Me.TextBox29.Text
    Else

    End If
    End Sub



    'this code was added aswell (unsure what this does apart from gthe msgbox)
    Private Sub TextBox29_AfterUpdate()

    Dim a As Long
    a = Application.WorksheetFunction.CountIf(Sheet1.Range("D:D"), Me.TextBox29.Text)

    If a >= 1 Then
    TextBox29 = ""
    MsgBox "REF number already Exist,Please check or add as sequence e.g 12345-1"
    End If
    End Sub




    basically i have textbox29 to textbox40 but i need each textbox checked against each other

    so textbox29 which is in columnD needs to be checked against column D,E,F,G,H,I,J,K,L,M,N,O and then textbox30 will do the same,and then textbox31 and so on..

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: userform stops duplicates entering data sheet

    Duplicate thread here
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    01-05-2023
    Location
    uk
    MS-Off Ver
    11
    Posts
    24

    Re: userform stops duplicates entering data sheet

    yes this was my post but started new one as new here

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: userform stops duplicates entering data sheet

    No...Carry on in your old post and add sample file as per Torachan advised...Duplicate threads are not allowed...

  5. #5
    Registered User
    Join Date
    01-05-2023
    Location
    uk
    MS-Off Ver
    11
    Posts
    24

    Re: userform stops duplicates entering data sheet

    Quote Originally Posted by sintek View Post
    No...Carry on in your old post and add sample file as per Torachan advised...Duplicate threads are not allowed...
    im trying to add the file but it keeps failing, ive saved it as torachan has requested but keeps saying its failed

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need Macro to store the values in sheet by entering in userform
    By Prabakaran3003 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-03-2017, 02:54 PM
  2. Userform stops inputting data into spreadsheet.
    By ASki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2015, 04:55 PM
  3. [SOLVED] Prevent duplicates when entering data
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 43
    Last Post: 12-09-2014, 02:32 AM
  4. Preventing Duplicates While Entering Data in Excel 2007
    By ExcelTip in forum Tips and Tutorials
    Replies: 2
    Last Post: 06-22-2014, 08:27 AM
  5. [SOLVED] Refresh UserForm after entering data in another userform
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2013, 10:34 AM
  6. Entering data and checking for duplicates dynamically
    By Robertski in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2012, 02:14 AM
  7. entering data to overwrite and delete duplicates
    By marshall in forum Excel General
    Replies: 3
    Last Post: 02-22-2006, 08:00 AM

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