Worksheet_Change to stop people copy & pasting into two seperate rows.

ScottDavies

New Member
Joined
Mar 9, 2016
Messages
6
Hey guys,

I've read about Worksheet_Change, but I cannot get it to work.

I have Row F with Data Validation active - it requires 11 numbers to be entered
I have row G with Data Validation active - it requires a number of 7000 or above, and appears as a whole number with 2 decimal places (i.e. no currency £, $, etc)

What I want to happen is if someone pastes some data into Row F/G that does not match the Data Validation, an error message to pop up, and not allow them to paste.

I obviously also want them to be unable to manually type any data that does not stick to the Data Validation rules also, and again come up with an error message.

Can it be done?

-Scott
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
3,789
Office Version
  1. 365
Platform
  1. Windows
What I want to happen is if someone pastes some data into Row F/G that does not match the Data Validation, an error message to pop up, and not allow them to paste.

AFAIK, if you paste something to a cell with data validation, the data validation will be erased. I don't know how to work around that.
An idea?
Hm, you might consider using combobox instead (embedded in the sheet not in a from) , it gives you more control. But I haven't created the macro yet, still in 'trial & error' phase.
Let me know if you're interested.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,282
Messages
5,836,400
Members
430,425
Latest member
xlsee

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
Top