Excel macro - Help with duplication validation macro

P

princess

I have created a spreadsheet which records seat types for cinem
bookings (e.g. adult, child, student, senior citizen, member).

I need to create a macro to check that each seat type has only bee
entered once.

If this is not the case then the macro also needs to inform the use
(e.g. through a message box) of the problem, and then be able to delet
any duplicate entries.

Could anyone please give me some ideas of the vb code I can use to b
able to do this?

Thanks for your help
 
P

princess

Thanks for your help but this doesn't seem to be implemented using a
macro (I am not able to use any other method than a macro).
 
N

nisht

Did you download the file i told you..

the code is in worksheet change event..

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column <> 1 Then Exit Sub
On Error GoTo err1
If Application.WorksheetFunction.CountIf(Range("a:a"), Target) > 1
Then
Target = ""
Target.Select
MsgBox "Duplicate Entry."
End If
err1:
End Sub


this the code i am using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top