ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel macro - Help with duplication validation macro (https://www.excelbanter.com/excel-programming/287250-excel-macro-help-duplication-validation-macro.html)

princess[_2_]

Excel macro - Help with duplication validation macro
 
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

--
Message posted from http://www.ExcelForum.com


nisht

Excel macro - Help with duplication validation macro
 
download my file: no a11

from www.pexcel.com and go to vba example.

you need to see the code.


---
Message posted from http://www.ExcelForum.com/


princess[_3_]

Excel macro - Help with duplication validation macro
 
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).


---
Message posted from http://www.ExcelForum.com/


nisht[_8_]

Excel macro - Help with duplication validation macro
 
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.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com