Using an action button.

M

MichaelZ

How do I insert a button into a spreadsheet that will "clear" all values from
cells that are intended for inputting data, but not clear other cells that
are not meant for data input? As part of this I suppose I need some way to
designate which cells are meant for data input and which ones are not.
Thanks, MichaelZ
 
D

Don Guillett

Simplest way. Hold down the control key while selecting each cell you want
to clear>goto the namebox just to the left of the formula box and type in
rngtoclear>fire this macro assigned to a shape or forms button.

Sub clearcells()
Range("rngtoclear").ClearContents
End Sub
 
M

MichaelZ

Ran into a little problem...
Some of the input cells were merged cells, so an error message reading,
"Cannot change part of a merged cell" was generated. Is there any way around
this? I still want to be able to clear the input cells, even if they are
merged cells.
Thanks.
 
D

Don Guillett

In the defined name, you will have to specifically reference the merged
cells as shown here. g9 not merged.
=Sheet28!$G$7:$H$7,Sheet28!$G$9,Sheet28!$G$11:$H$11
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top