Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Data validation doesn't work if contents is added by pasting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeff.taylor@virgin.net - 05 Nov 2006 08:44 GMT
Hi

I've data validation set so that only the number 1 can be entered, but
even this cannot be entered if an adjacent cell is a certain value.
this works for direct entry, but not if the value is pasted in or added
using the "drag handle".

Is there any way to stop this happening as I just know somewones going
to try and fill all the cells by draging the values down.

Regards

Jeff
Jim Cone - 05 Nov 2006 21:25 GMT
Jeff,
You could disable "Allow cell drag and drop" in Tools | Options or...
copy the following  code, right click the sheet tab and choose
'view code'.  Paste the code into the module.
It does not take the "adjacent" cell in to account however.
Also, any formula that returns a value of 1 is allowed.
Change B5 to the correct cell.

'----------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ChangeErr
Application.EnableEvents = False
If Target.Address = "$B$5" Then '  <<<correct
  If Len(Target.Value) Then
     If Target.Value <> 1 Then Target.ClearContents
  End If
End If
ChangeErr:
Application.EnableEvents = True
End Sub
-----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

<jeff.taylor@virgin.net>
wrote in message
Hi
I've data validation set so that only the number 1 can be entered, but
even this cannot be entered if an adjacent cell is a certain value.
this works for direct entry, but not if the value is pasted in or added
using the "drag handle".
Is there any way to stop this happening as I just know somewones going
to try and fill all the cells by draging the values down.
Regards
Jeff

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.