I need to make a clear button that will delete any info within a bunch of different cells within a spreadsheet. Are there any example codes of how I can do this?
Thanks,
I need to make a clear button that will delete any info within a bunch of different cells within a spreadsheet. Are there any example codes of how I can do this?
Thanks,
hi, you can use this piece of code.
![]()
Please Login or Register to view this content.
Corine
Sorry, I am not the best with excel programming. I put the code in, but I don't see anything.
I need a button on the excel page that users can click after filling out and printing the worksheet that will clear out certain cells throughout the worksheet so they can start over without having to manually clear everything out. I have seen this done before but I don't know how to do it. Can someone give me a code to do this?
Thanks
It is going to be very difficult for us to give you a specific answer when you have provided no information to work with.
Corinareyes has provided a concise example that demonstrates GENERALLY how you can clear cells using macros. Attaching his code to a command button will clear out cells B7, F7, and I7.
If you need more help, please provide a sample file or specific details.
I thought I would add that I know how to create a button and link it with a macro, I just don't know how to get a code that will clear selected information within the spreadsheet.
I also need it to confirm that you wish to do the clearing. For example, you click the button and it says, "Are you sure you wish to clear this spreadsheet?" And you either type Y or N or press a button or something.... then it clears cells A7 E9 G3 H2 for example.
Thanks,
Big Bas,
I know how to insert code into the worksheet, but I don't know how to attach it to a button. I can link a macro to a button, but when I put the code in the worksheet I don't see any macro to attach.
Also, is there a way for the information to be confirmed before clearing. My previous post contains more info on what I want specifically.
Thanks
Make sure you enter your code into a Module, and not into the sheet code. To do so:
-Press Alt+F11 to open the VBE
-In the VBE, go to INSERT-MODULE
-Copy the code I will provide below.
Next, add a button from the Forms toolbar
-In Excel (not the VBE), go to VIEW-TOOLBARS-FORMS
-Choose the command button icon and add command button to your sheet
-Right Click the command button and go to Assign Macro.
-Choose the "Clear_It" macro.
NOTE: This macro will clear any information in cell A1. Change it to suit:
Post if you need more help.![]()
Please Login or Register to view this content.
You ROCK! Thanks SO MUCH!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks