Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default List to manage employee code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default List to manage employee code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default List to manage employee code

Use Data Validation.

see http://www.j-walk.com/ss/excel/usertips/tip027.htm

DM Unseen

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default List to manage employee code

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i find the manage list excel New Users to Excel 1 August 4th 08 01:45 PM
Enhance sumproduct to return unique employee code count Max Excel Worksheet Functions 5 December 4th 07 05:54 PM
Employee list Dave New Users to Excel 3 January 9th 07 10:29 PM
employee phone list template Carol Excel Worksheet Functions 1 August 1st 05 05:15 PM
I am looking for an excel template to manage our customer list. A. Vishal Excel Discussion (Misc queries) 1 March 24th 05 12:33 AM


All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"