View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Preventing Duplicate Entries Across Sheets

Ken,

It doesn't work because I'm stoopid and didn't check my code.

Change the OR to an AND in this line:

If Target.Cells.Count 1 Or (Sh.Name < "Sheet2" _
Or Sh.Name < "Sheet3") Then Exit Sub

Should be:

If Target.Cells.Count 1 Or (Sh.Name < "Sheet2" _
And Sh.Name < "Sheet3") Then Exit Sub


Sorry about that,
Bernie
MS Excel MVP

"Ken" wrote in message
...
Hmmm... for some reason, this substitution doesn't work -
it allows duplicates. Any ideas? I'd love to try and learn
VBA a bit. Any good books/sites? Thanks again!

Ken
-----Original Message-----
Ken,

Change
If Target.Cells.Count 1 Then Exit Sub

To
If Target.Cells.Count 1 Or (Sh.Name < "Sheet2" _
Or Sh.Name < "Sheet3") Then Exit Sub

And change:
For Each mySh In ThisWorkbook.Worksheets

to
For Each mySh In Sheets(Array("Sheet2", "Sheet3"))

HTH,
Bernie
MS Excel MVP

"Ken" wrote in

message
...
this works great. thanks so much. can i apply it to just
two of three sheets? e.g. sheet 2 and 3, but not sheet

1?
or does that require more VBAing?




.