ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS? (https://www.excelbanter.com/excel-discussion-misc-queries/126262-add-button-cell-delete-range-cells.html)

traveye

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
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?

Mike

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
From the forms toolbox put a button on your sheet and when the popup window
comes up click on new macro and add the following code.

Range("B1:B12").Select
Selection.ClearContents

Mike

"traveye" wrote:

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?


Don Guillett

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
right click sheet tabview codeinsert 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.

--
Don Guillett
SalesAid Software

"traveye" wrote in message
...
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?




traveye

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
Thanks, it works great!

"Mike" wrote:

From the forms toolbox put a button on your sheet and when the popup window
comes up click on new macro and add the following code.

Range("B1:B12").Select
Selection.ClearContents

Mike

"traveye" wrote:

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?


dow

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
How Can I do that for multiple cells that are not contiguous. I am a novice.
--
dow


"Mike" wrote:

From the forms toolbox put a button on your sheet and when the popup window
comes up click on new macro and add the following code.

Range("B1:B12").Select
Selection.ClearContents

Mike

"traveye" wrote:

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?


Dave Peterson

ADD A BUTTON TO A CELL TO DELETE A RANGE OF CELLS?
 
range("b1:b2,C17:d99,g13,z:z,105:105").clearconten ts

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

dow wrote:

How Can I do that for multiple cells that are not contiguous. I am a novice.
--
dow

"Mike" wrote:

From the forms toolbox put a button on your sheet and when the popup window
comes up click on new macro and add the following code.

Range("B1:B12").Select
Selection.ClearContents

Mike

"traveye" wrote:

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?


--

Dave Peterson


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com