Using an action button.

  • Thread starter Thread starter MichaelZ
  • Start date Start date
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
 
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
 
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.
 
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
 
Back
Top