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.)
 

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

Similar Threads

Count IF/And 1
Excel macro help needed 0
How to Loop? 1
Code to clear sheet 5
Excel Vba to change displayed year automatically. 14
clear contents on linked sheet 2
Clear check box problem 1
help with an array formula 3

Back
Top