Stop Duplicate Entries.

elnunezgib

New Member
Joined
Oct 29, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi All, looking for some advice or assistance.
I am creating a desk booking spreadsheet.
On this workbook, I have the list of names on Sheet 1. On Sheet 2, column A will be populate will be desk (e.g. Desk 1 in Cell A1, Desk 2 in Cell A2, etc, etc.) and column B will have the data validation list from sheet 1 (A1:A50)

How can I "program" excel so that when data is selected on column B (List From Data Validation), I would like to stop duplication to occur on that same column further down the rows, i.e. stopping same person booking two desks
 

Attachments

  • Screenshot 2024-10-29 141903.png
    Screenshot 2024-10-29 141903.png
    7.6 KB · Views: 2

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for Sheet2 and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in column B.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    If WorksheetFunction.CountIf(Range("B:B"), Target.Value) > 1 Then
        MsgBox ("You have already booked a desk.")
        Target.ClearContents
    End If
    Application.ScreenUpdating = True
    Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top