+ Reply to Thread
Results 1 to 3 of 3

Userform - check for duplicate entries

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    13

    Userform - check for duplicate entries

    Hi all,

    I was hoping for some help on this code. I have got a userform that is used to book and delete holidays into an excel spreadsheet. This is working brilliantly now thanks to a lot of help from a number of different people.

    I wanted to add in a safety net somehow. So when I want to book dates, the code checks to see if there is a matching entry based on a persons name, the holiday dates (from and to) and the absence reason (ie holiday, sickness, etc).

    I'm a little bit stumped as to how to do this, would appreciate any advice?

    Dim emptyRow As Long

    'Make Absence log Active
    Sheets("Absence log").Activate

    'Determine emptyRow
    emptyRow = WorksheetFunction.CountA(Range("A:A")) + 2

    'Export Data to worksheet

    Cells(emptyRow, 1).Value = EmployeeName
    Cells(emptyRow, 2).Value = CDate(Me.DateFrom)
    Cells(emptyRow, 3).Value = CDate(DateTo)
    Cells(emptyRow, 4).Value = absencereason
    Cells(emptyRow, 5).Value = Staff_Agency
    Cells(emptyRow, 6).Value = SAPNumber
    Cells(emptyRow, 7).Value = Add_information

    Thanks Glynn

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Userform - check for duplicate entries

    I would add hidden lookup field at the end, then concatenate the entries in the sheet to check it. Or you could do a COUNTIFS worksheet function for the entries.

  3. #3
    Registered User
    Join Date
    05-07-2013
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Userform - check for duplicate entries

    Hi Nathan,

    Thanks for your message, I didn't seem to get to far. I've also thought whether I've asked the right question. I'm adding a range of dates (from to) onto a spreadsheet. I guess I'd need to validate any duplication between these dates.

    For example, Joe Bloggs has been booked as being on holiday 10th March - 15th March, If I try to book him either more leave or onto a course between these dates then I'd need the code to pick this up and give a message stating what he's already booked for?

    Not sure if that is possible?

    Thanks for your time.

    Glynn

+ 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