create a clear button

G

Guest

I've read some of the other on here and can't get it to work.

I have cells A3:A7,A10,D3:D7,G3:G7

I want the values in these cells to be deleted when I click a Clear All
button.

So, do I create the button, go to view code and enter it there. I
specifically need help with the code.

Any help would be great...thanks,

Jeff
 
L

L. Howard Kittle

Hi Jeff,

Pretty straignt forward.

Sub ClearIt()
Range("A3:A7,A10,D3:D7,G3:G7").ClearContents
End Sub

Copy and paste in the sheet module(View Code) and then make your button from
the forms tool bar and assign the macro to the button.

HTH
Regards,
Howard
 
G

Guest

Rather than writing your own code, I'd suggest using the Macro Recorder for
this.

1. Select TOOLS
2. Select MACROS
3. Select RECORD NEW MACRO...
4. Give the Macro a name (or just use the default)
5. Select your cells (hold down the Ctrl key to select multiple non-adjacent
cells)
6. Hit DELETE on your keyboard
7. Select a cell where you want the focus to be after cells are cleared.
(perhaps A3?)
8. Stop recording the macro
9. If you've already placed the button on your sheet, then right-click it
and select "Assign Macro"
10. If not, place the button and assign the Macro.

Post back if you need more assistance.

HTH,
Elkar
 
G

Guest

Thanks for the response...

How do I assign the macros? When I right click it doesn't give me the
option.
 
L

L. Howard Kittle

Thanks, but when I right click it doesn't give me the option to assign

Use a button from the Forms toolbar.

View > ToolBars > check Forms

Now make your button from that tool bar using the button icon.

HTH
Regards,
Howard
 
L

L. Howard Kittle

See my last response, the 2:00PM one.

jbf frylock said:
Thanks for the response...

How do I assign the macros? When I right click it doesn't give me the
option.
 
G

Guest

He skipped a step.

8 1/2. Right click the button and hit Customize

This will put you in the mode were you can customize the menu area. You can
actually right click anywhere in the menu area.
 

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

Top