Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have used the following code to give me a warning of duplicated values in a
column, at least I thought it should do this. It does in fact give me the warning in the column BUT it give me the warning if in the same row and this is permitted. How do I get the code correct so it just gives me the warning for the column values and not the row? Thanks Private Sub Worksheet_Change(ByVal Target As Range) 'Adjust next constant to your own needs Const myColumn As String = "B:AF" Dim rng As Range Dim Found As Range Set rng = UsedRange.Columns(myColumn) If Intersect(Target, rng) Is Nothing _ Or Target.Value = "" _ Then Exit Sub Set Found = rng.Find(Target.Value) If Found.Address < Target.Address Then Target.Select MsgBox ("Duplicate code") End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Preventing duplicate data | Excel Discussion (Misc queries) | |||
Copy / Paste Warning | Excel Discussion (Misc queries) | |||
Warning while entering duplicate values in a cell | Excel Discussion (Misc queries) | |||
Macro warning box | Excel Discussion (Misc queries) | |||
DUPLICATE VALUES | Excel Worksheet Functions |