Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm making a list of employee info , i want to do the following :
Whenever i enter a value in a cell of employee code feild , excel checks if it is duplicated or not , if yes display an error message "Value duplicated " or any action to reject the inserted value, if no the new value is accepted Thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nFound As Long On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then With Target If Application.CountIf(Me.Range("A1:A100"), .Value) 1 Then MsgBox .Value & " is duplicate" .Value = "" End If End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips "Tahani" wrote in message ... I'm making a list of employee info , i want to do the following : Whenever i enter a value in a cell of employee code feild , excel checks if it is duplicated or not , if yes display an error message "Value duplicated " or any action to reject the inserted value, if no the new value is accepted Thank you |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much
Appreciate your help "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Dim nFound As Long On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then With Target If Application.CountIf(Me.Range("A1:A100"), .Value) 1 Then MsgBox .Value & " is duplicate" .Value = "" End If End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips "Tahani" wrote in message ... I'm making a list of employee info , i want to do the following : Whenever i enter a value in a cell of employee code feild , excel checks if it is duplicated or not , if yes display an error message "Value duplicated " or any action to reject the inserted value, if no the new value is accepted Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i find the manage list | New Users to Excel | |||
Enhance sumproduct to return unique employee code count | Excel Worksheet Functions | |||
Employee list | New Users to Excel | |||
employee phone list template | Excel Worksheet Functions | |||
I am looking for an excel template to manage our customer list. A. | Excel Discussion (Misc queries) |