Clearing Cells using a Macro and a button

hsingh2088

New Member
Joined
May 6, 2011
Messages
35
I've tried at least 4 or 5 different solutions on this forum and none of them have worked. I need to clear contents of cells within a range from rows 12 to 26, then rows 29 to 31 then 33 to 49 then 42 to 43 and columns E through N. I don't need any fancy coloring or anything like that, I just want to clear the contents of the cells. Can someone please show me the code for a sheet called "Summary?"

Thanks
 
First (and preferred) method :
Don't use merged cells.
VBA and Merged Cells mix togeter about as well as Oil and Water.
A very similar effect to merged cells can be achieved with
"Center Accross Selection"
Found in the same window as merged cells, under "Text Alilgnment" Horizontal


Second method...
Only the Top Left Cell of the merged range actually contains any data...
So you only need to refer to the top left cell of the merged range...
So if the Merged Range is A1:D10, then you would only write
Range("A1").ClearContents.


Hope that helps.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Sorry I never got back to this yesterday, (work getting in the way of life again), but after your first response to our posts I was wondering if merged cells were going to be the culprit.

Jonmo's right. As far as VBA is concerned, "merged cells is the devil." :mad:
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,421
Members
452,913
Latest member
JWD210

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