View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Applewine[_5_] Applewine[_5_] is offline
external usenet poster
 
Posts: 1
Default Checking for Duplicate entry using VBA (?!)


Msg = "Enter new employee name:"
EmployeeName = InputBox(Msg, vbCancel)
If EmployeeName = "" Then Exit Sub '

Do
Flag = 0
Msg = "Enter new employee name:"
For i = 10 To 160
If ActiveSheet.Cells(i, 4) = EmployeeName Then Flag = 1
Next
If Flag = 1 Then Msg = "There is already an employee by that name..try
again:"
If Flag = 1 Then EmployeeName = InputBox(Msg, vbCancel)
Loop While Flag = 1

Thanks, Moo, for your help!

-Dave


--
Applewine
------------------------------------------------------------------------
Applewine's Profile: http://www.excelforum.com/member.php...fo&userid=5512
View this thread: http://www.excelforum.com/showthread...hreadid=397585