data validation

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
313
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
i have a cell A1 which has data validation so that it is either 1 or 2. if user enter 3, there is an error msg prompting the user to re-enter number 1 or 2... this is fine.

B1 contains 3. if a user copy B1 and then paste it in A1... then there is no msg prompting. so the user manager to enter 3 in A1 by copy/paste from another cell. how can i prevent that?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
if your drop down is in sheet 1 A1 put this code in sheet 1 and it will prevent paste in A1

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Application.CutCopyMode = True
End If
End Sub
 
Upvote 0
if your drop down is in sheet 1 A1 put this code in sheet 1 and it will prevent paste in A1

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Application.CutCopyMode = True
End If
End Sub
That takes care of cut/copy and paste...

But you can still drag -n- drop!

It might be better to just forget about using data validation and use a change event macro.
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top