ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to add a button to a cell wich will clear data in a range of cells.
example: click on cell A1 and it will clear data from cell b1 thru b12. Is
this possible?
 
right click sheet tab>view code>insert this. Now when you DOUBLE click cel
a1 b1:b12 cleared

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$A$1" Then Range("b1:b12").ClearContents
End Sub

However, I suspect you did NOT fully state your problem.
 
range("b1:b2,C17:d99,g13,z:z,105:105").clearcontents

You don't need to select a range to clear it.
 

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

Back
Top