Anyway to get around "Cannot change part of a merged cell" in VBA?

UncleBajubjubs

Board Regular
Joined
Jul 11, 2017
Messages
111
Office Version
  1. 2010
Hello, I made a macro to go through a long worksheet and clear out all the entries in certain cells, using the following example code

<Code>
Range("G297").Clear
Range("R297").Clear
Range("D298").Clear
Range("L298").Clear
Range("S298").Clear
Range("D299").Clear
</code>

I did this for hundreds of cells, typing in the cells I needed to clear, as this sheet will be filled in and cleared regularly. I got tunnel vision while working on this and forgot that all the cells to be cleared are merged, and thus I get the error "Cannot change part of a merged cell". Is there any easy way to fix this, or will I have to go to each of the cells, and make them unmerge and then merge again after they are cleared? Since there's hundreds of them, that'd take a while to type, so I'm hoping there's another way.
Thanks.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Upvote 0

Forum statistics

Threads
1,214,384
Messages
6,119,201
Members
448,874
Latest member
Lancelots

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