LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
J_J J_J is offline
external usenet poster
 
Posts: 58
Default Accept on condition only !

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want a cell should 2 accept only =0 or <=30 or Y or N Brijesh Poojary New Users to Excel 1 April 6th 10 06:45 AM
Accept or Reject a value crabflinger Excel Worksheet Functions 1 April 3rd 09 05:46 PM
lookup with multiple condition, but one condition to satisfy is en Eddy Stan Excel Worksheet Functions 2 October 27th 07 02:06 PM
Track/Accept Changes WhOkNoWs Excel Worksheet Functions 0 August 22nd 07 02:26 PM
license box accept sherrysue11 Excel Discussion (Misc queries) 0 July 20th 06 02:42 PM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"