VBA Code to pretect certain range of sheet with some features

m_aatif

Board Regular
Joined
Apr 18, 2013
Messages
56
I have a sheet named " sheet1".My data is from row A1 to E20. some cells have data validation as well. I need code which performs following control tasks.

1) User should not be able to add / delete any row or column in the range A1 to E 20.
2) Wherever i have data validation in any cell, user should be able to select from data validation only. should not be able to enter anything manually.
3) In column B, user should be able to enter text and numeric as well.
4) In column A,C,D &E, user should be able to enter numbers only.


Thanks
Atif
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
most of this is just straight Data > Validation settings, coupled with Worksheet Protection

The biggest problem is that Data > Validation can be pasted straight over using simple copy/paste. You could use application.cutcopymode = false to prevent this, triggered by the "worksheet selection change" event if someone selects within your restricted area - but your Users might want to be able to copy/paste, and it relies on macros being enabled

A better approach might be to include basic formulas that report any errors entered. I'm not convinced that VBA is the way to go in this case
 
Upvote 0

Forum statistics

Threads
1,203,489
Messages
6,055,722
Members
444,814
Latest member
AutomateDifficulty

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