ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   create a clear button (https://www.excelbanter.com/excel-discussion-misc-queries/63625-create-clear-button.html)

jbf frylock

create a clear button
 
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. Howard Kittle

create a clear button
 
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

"jbf frylock" wrote in message
...
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




Elkar

create a clear button
 
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

"jbf frylock" wrote:

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


jbf frylock

create a clear button
 
Thanks, but when I right click it doesn't give me the option to assign macros.

"Elkar" wrote:

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

"jbf frylock" wrote:

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


jbf frylock

create a clear button
 
Thanks for the response...

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

"L. Howard Kittle" wrote:

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

"jbf frylock" wrote in message
...
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. Howard Kittle

create a clear button
 
Thanks, but when I right click it doesn't give me the option to assign
macros.


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

"jbf frylock" wrote in message
...
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. Howard Kittle

create a clear button
 
See my last response, the 2:00PM one.

"jbf frylock" wrote in message
...
Thanks for the response...

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

"L. Howard Kittle" wrote:

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

"jbf frylock" wrote in message
...
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







jbf frylock

create a clear button
 
Thank you so much. Amazing how quickly it works when done correctly.

"L. Howard Kittle" wrote:

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


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

"jbf frylock" wrote in message
...
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. Howard Kittle

create a clear button
 
Your welcome, and you will be catching on the more you do.

"jbf frylock" wrote in message
...
Thank you so much. Amazing how quickly it works when done correctly.

"L. Howard Kittle" wrote:

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


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

"jbf frylock" wrote in message
...
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







Sloth

create a clear button
 
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.

"jbf frylock" wrote:

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

"Elkar" wrote:

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

"jbf frylock" wrote:

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



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

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