Prevent users from merging cells in a specific range

Iventia

New Member
Joined
Jun 18, 2023
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello,

Is there any VBA code that prevents users from merging cells in a specific range? For instance "Sheet1-10!A21:H60" specifically. I have multiple sheets that require this code but only within this exact cell range. I have searched a bit and found one that affects the whole workbook but there are merged cells outside this range that needs to be merged. Also the users must be able to edit the cells so I can't lock them either. If possible it should be something that detects a merged cell in that range, popsup a warning error and undos, as some users copy and paste into the range.

Also separately, I'd like to ask if its possible to prevent to insert rows or columns within this column A-H and rows 21-60?

Thanks in advance.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

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