View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ikaabod[_61_] Ikaabod[_61_] is offline
external usenet poster
 
Posts: 1
Default validating data in acolumn


How about something like this? Of course you can make the inputbox a
specific cell or the activecell if you choose... that's just an example
since you didn't specify. Hope that helps.

Sub MyTest()
Dim MyStr As String
MyStr = InputBox("New Invoice:")
Columns("A:A").Select
Range("A1").Activate
On Error GoTo NoDuplicate
Selection.Find(What:=MyStr, LookAt:=xlWhole).Activate
GoTo Duplicate
Duplicate:
'Code for if duplicate is found
Exit Sub
NoDuplicate:
'Code for if NO duplicate is found
Exit Sub
End Sub


delmac Wrote:
Hi all, I've got a column of invoice numbers and each time I add one I
want
to make sure it it is not duplicated. I've tried using a function with
copy/paste validation, but it doesn't always work as the invoices can
be text
as well as number. Any ideas. Thanks very much.
--
delmac



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=542146