clear button

  • Thread starter Thread starter YMC
  • Start date Start date
Y

YMC

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
 
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
 
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
 
use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear
 
Gary''s Student said:
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
 
Activesheet.Range("F6:G22,K6:K17").ClearContents

(I like to qualify my ranges, too.)
 
Back
Top