LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Preventing Duplicate Entries Across Sheets

Working great now. Looks like i had to change the security
parameters. Thanks again for all your help. You are indeed
an Excel guru.

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

Make sure that the spelling and spacing of the Sheet2 and

Sheet3 strings in
this line exactly match the spelling and spacing on the

sheet tabs:

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

Other than that, it works great for me..... I can send

you a working version
if you are interested, and then you can figure out from

there where you are
going astray.

HTH,
Bernie
MS Excel MVP

"Ken" wrote in

message
...
Well, i'm doing something wrong. It works great with the
whole workbook but when i tried to make it just those

two
sheets, it stops working altogether. However, I don't

want
to have to keep bugging you for help, so I guess I'll

just
leave it at the workbook level... But thanks so much.

Ken
-----Original Message-----
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?



.



.



.

 
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
Preventing duplicate data tillytee1 Excel Discussion (Misc queries) 2 March 20th 06 03:49 PM
Preventing Duplicate Cells BenBlair Excel Discussion (Misc queries) 2 May 19th 05 06:08 PM
Preventing Duplicate Entries within a column Bruce Excel Discussion (Misc queries) 3 January 29th 05 12:33 AM
Preventing Duplicate Entries in rows AJPendragon Excel Worksheet Functions 1 December 6th 04 12:45 PM
VBA - Preventing duplicate entries using a macro princess[_4_] Excel Programming 6 January 22nd 04 01:10 PM


All times are GMT +1. The time now is 10:41 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"