Clear contents of merged cells

Paella1

Active Member
Joined
Mar 10, 2005
Messages
382
Is there a clever way to clear the contents of merged cells without getting "Cannot change part of a merged cell" ?

The only way I can get it to work is by selecting the cell. This offends the coding gods.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

wut

Banned
Joined
Dec 13, 2010
Messages
229
Every method will fail unless you target the whole range. There's nothing wrong with changing a merged range; it's part of a merged cell you can't change
 

Paella1

Active Member
Joined
Mar 10, 2005
Messages
382

ADVERTISEMENT

The "target" is an offset from a cell that has been changed (the procedure is event triggered, so target is an unfortunate choice of terminology). It may or may not be part of merged range. I am trying to think of a way that will target the entire range if the "target" is merged.
 

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,792
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

You can do this on any part of a merged cell:-
Code:
Range([I]whatever[/I]).MergeArea.ClearContents
 
Last edited:

Paella1

Active Member
Joined
Mar 10, 2005
Messages
382
Ruddles, that is magnificent! I shall have your post embroidered on fine lace so I may pass it on to my grandchildren.
 

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,792
Office Version
  1. 365
Platform
  1. Windows
I got it from my own dear grandmother in a very similar sort of way!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,436
Messages
5,837,236
Members
430,487
Latest member
michaeltusi

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