Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi mangesh,
Thank you so much for your code. It works perfectly OK. I need just a little bit further then this to make it even more effective. Your code reminds the user that a "duplicate recored" has been entered. But I think that it will be even better if the code "removes" the entered duplicate row as well when we click pass "OK" the message box. A second (and much more needed) improvement to your code may be this: Can we add another "If" statement to your code so that when we input the "period" & "activity" & "trainer" values it will also check columns 3, 4, 5 and if it finds that there is a PARTLY match (only the "period" & "activity" data matches but "trainer" data differs) then the program will warn the user by displaying a message box with the message "The " & activity & " lesson on " & "period" & "is beeing used by " & <The found unmatched trainer name ? "Should I remove the old record and put this new data line to the sheet (Y/N)?" And if we enter "Y" OR "y" it will do so, but if we enter anything else it will keep the old record and delete the lastly entered partly matching row? Hope I have not asked too much Regards Sincerely J_J "J_J" wrote in message ... Thanks mangesh_yadav, I'll try this and get back to this thread for comment. J_J "mangesh_yadav" wrote in message ... In the module for sheet1, you can write the following code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.Column <= 5 Then ' 3 to 5 stand for C to E columns For i = 1 To Target.Row - 1 If (Cells(i, 3) = Cells(Target.Row, 3)) And (Cells(i, 4) = Cells(Target.Row, 4)) And (Cells(i, 5) = Cells(Target.Row, 5)) Then MsgBox "Duplicate record" End If Next End If End Sub - Mangesh -- mangesh_yadav ------------------------------------------------------------------------ mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470 View this thread: http://www.excelforum.com/showthread...hreadid=275852 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I want a cell should 2 accept only =0 or <=30 or Y or N | New Users to Excel | |||
Accept or Reject a value | Excel Worksheet Functions | |||
lookup with multiple condition, but one condition to satisfy is en | Excel Worksheet Functions | |||
Track/Accept Changes | Excel Worksheet Functions | |||
license box accept | Excel Discussion (Misc queries) |