Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help to alter code slightly
When a user selects from a list box, the product and the cost ar automatically placed into columns a and b. The following code was s kindly provided to me to ensure there are no duplicate values in colum a. How would I alter the code slightly so that if it does not accep the duplicate value for column a it will not enter the cost into colum b as well? Thank you so much for this it is a critical piece of my plan :) Private Sub Worksheet_Change(ByVal Target As Range) If ((Target.Row = 1 And Target.Row <= 100) And Target.Column = 1 Then If (Range("a" & Target.Row).Value < "") Then For i = 1 To 100 If (i < Target.Row And Range("a" & Target.Row).Value < "") Then If (Range("a" & i).Value = Range("a" & Target.Row).Value) Then MsgBox "entered duplicate value" Range("a" & Target.Row).Value = "" End If End If Next End If End If End Su -- novicevbae ----------------------------------------------------------------------- novicevbaer's Profile: http://www.excelforum.com/member.php...fo&userid=1256 View this thread: http://www.excelforum.com/showthread.php?threadid=31942 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
alter code to apply to range (links cells w/ row insertions) | Excel Discussion (Misc queries) | |||
Alter pivot with code | Excel Discussion (Misc queries) | |||
Slightly OT (Maybe) printing problem | Excel Worksheet Functions | |||
Alter existing code | Excel Programming | |||
Something slightly harder... | Excel Programming |