Pasting into a cell with data validation

Dave Punky

Board Regular
Joined
Jan 7, 2010
Messages
133
Hi all,

I'm having a real issue in regards to being able to paste into a cell which supposedly has data validation on it.

Basically I have a cell with a dropdown which gives one of 3 options. If you try and type manually into this cell it's fine it throws up the error saying you can't do that. However if I paste into the cell it goes completely unchallenged and just sits there.

I also have the same issue with a cell which has data validation for date specific values, I can just copy text into it and it completely defeats the object of having data validation in the first place.

Is there any way of disabling paste into specific cells, so say A1 has validation on it then you can't paste into that cell, you either have to manually type in or make a selection?

Any help would be appreciated!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
OK, two things:

rgnVal should be defined with Worksheet scope:

Sps1!rgnVal refers to: ~ (the definition is fine (didn't look closely), the name is not)

Then delete the routine SuperPaste
 
Upvote 0
The only annoying thing with that is SuperPaste was the only thing I could find/work out to stop pasting screwing up any conditional formatting in place in a cell on the sheet. I never got an official answer on that in my original post on it. I've deleted it anyway.

And I've defined Sps1!rgnVal under the following line (and changed the name as I know I had VAL in caps):

Code:
    On Error Resume Next
    Set rChk = Intersect(r, r.Worksheet.Names("Sps1!rgnVal").RefersToRange)

However even with those changes it's exactly the same, can still paste into those cells without challenge. You sure none of the other scripts could be causing the problem or have I missed something again when correcting your script?
 
Upvote 0
When code, like your SuperPaste, modifies a worksheet, it flushes the undo stack, Dave.

And I've defined Sps1!rgnVal under the following line ...
That's not what I suggested -- please don't change the code. One sheet Sps1,

Insert > Name > Define, Sps1!rgnVal

I deleted SuperPaste and corrected the definition of rgnVal -- that's all -- and it worked fine.
 
Upvote 0
Sorry my bad, misunderstanding on my part. Corrected that back to the original code.

I've done exactly as you specified and again it's not working. Are you able to upload your version of the spreadsheet where it works so I can see for myself, as it won't let me define the name as Sps1!rgnVal, rather just rgnVal on Sps1.
 
Upvote 0
Ok I think maybe there's something wrong with my excel because I can still paste into those ranges on your version of the sheet without issue - despite the fact I can clearly see how it works and there is simply no logical reason why it shouldn't work.

Just for my sanity, is there any way of creating a formula assigned to a macro so when assigned to Ctrl & V, it just activates this macro or doesn't paste into those cells? I'm gonna test that sheet on another machine too just to make sure it's not just this machine.
 
Upvote 0

Forum statistics

Threads
1,223,635
Messages
6,173,481
Members
452,516
Latest member
archcalx

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