Run macro after paste?

winxpdows

New Member
Joined
Apr 21, 2011
Messages
24
Hi, All.

I'm building an add-in with data validation. But if a user copies and pastes over cells the data validation that was there is wiped out. Is there a way to catch if a user has pasted data into a sheet so that I can run a macro to reinstall the data validation? I don't want to use Sheet change code because I want to prompt the user to ask them if they want to reinstall the data validation... I just can't figure out a way to handle if data has been pasted.

Thanks in advance!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
There is a workaround, it's kinda wiered and I'm not sure why it works...

But anyway...

Highlight the range of Data Validation
Click Tools - Protection - Allow users to edit ranges
Cick New - give it a name, make sure it references the right range.
Click OK
Click OK

Now protect the sheet from Tools - Protection - Protect Sheet


Now when pasting over, your data validation will be preserved..


If you were not already using sheet protection, you can basically make the protection invisible..

Highlight all cells, click Format - Cells - Protection
UNcheck Locked
Click Tools - Protection - Protect Sheet
put a check on ALL boxes
Then click OK without a password

so protection is ON, but it's not actually protecting anything.


Hope that helps, and was clear enough..
 
Upvote 0
Thanks Jonmo...

That's a workaround, but... I'd still like to find a way to run a macro when the user pastes something... Appreciate your help, though.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,855
Members
452,948
Latest member
UsmanAli786

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