ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clear button (https://www.excelbanter.com/excel-programming/406760-clear-button.html)

YMC

clear button
 
Is it possible to make a button clear certain cells. i want a button that
will clear F6:G22 and K6:K17
i am not to sure how to put together the code. could someone please give me
an example? thankyou

Gary''s Student

clear button
 
View Toolbars Forms

click on the button icon and put a button on the worksheet. When the Assign
Macro dialog box appears, select new and enter:

Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub
--
Gary''s Student - gsnu200770


"YMC" wrote:

Is it possible to make a button clear certain cells. i want a button that
will clear F6:G22 and K6:K17
i am not to sure how to put together the code. could someone please give me
an example? thankyou


YMC

clear button
 

Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub



the only problem with this is that it completely clears everything. i just
want it to clear the information in the cells, and leave the color and
formats

Gary''s Student

clear button
 
use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear
--
Gary''s Student - gsnu200770


"YMC" wrote:


Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub



the only problem with this is that it completely clears everything. i just
want it to clear the information in the cells, and leave the color and
formats


YMC

clear button
 


"Gary''s Student" wrote:

use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear

that works great accept it is clearing everything in between H-J column.
just want what i specified in F, G, and K cloumn i just want the specified
cells to clear

Dave Peterson

clear button
 
Activesheet.Range("F6:G22,K6:K17").ClearContents

(I like to qualify my ranges, too.)

YMC wrote:

"Gary''s Student" wrote:

use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear

that works great accept it is clearing everything in between H-J column.
just want what i specified in F, G, and K cloumn i just want the specified
cells to clear


--

Dave Peterson

YMC

clear button
 


"Dave Peterson" wrote:

Activesheet.Range("F6:G22,K6:K17").ClearContents

(I like to qualify my ranges, too.)


That works perfect! thankyou very much


All times are GMT +1. The time now is 05:57 PM.

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