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
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
2,937
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,493
Messages
5,601,998
Members
414,490
Latest member
Rip181

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