PC Review


Reply
Thread Tools Rate Thread

column with unique value alowed to added only else violation

 
 
charles
Guest
Posts: n/a
 
      17th Dec 2007
i wont make a columne pf number if i add a new valew in a neww cell exicting
befor in this column one msg apear and the fot of this new cell chage to red
thaks
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      17th Dec 2007
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Font.ColorIndex = xlColorIndexAutomatic
If Application.CountIf(Me.Columns(.Column), .Value) > 1 Then
MsgBox "duplicate value"
.Font.ColorIndex = 3
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


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"charles" <(E-Mail Removed)> wrote in message
news:554E3096-08D9-427D-8E60-(E-Mail Removed)...
>i wont make a columne pf number if i add a new valew in a neww cell
>exicting
> befor in this column one msg apear and the fot of this new cell chage to
> red
> thaks



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filer for unique records and return all column data for unique rec bseeley Microsoft Excel Misc 1 12th Sep 2009 12:17 AM
Unique constraint violation when Filling a Dataset Hugh Barnett Microsoft ADO .NET 0 9th Oct 2004 01:22 PM
Unique constraint violation when Filling a Dataset Hugh Barnett Microsoft VB .NET 1 9th Oct 2004 08:24 AM
Primary Key of string values (trims spaces from the end of strings) causes unique violation =?Utf-8?B?SmVmZiBGbG93ZXJkYXk=?= Microsoft ADO .NET 3 20th Feb 2004 03:31 PM
Unique Ke Violation Jim Heavey Microsoft ADO .NET 3 26th Dec 2003 06:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 AM.