Multiple Reset Buttons

supermanjohn01

New Member
Joined
Jul 10, 2018
Messages
26
I have created an Active x control reset button on a worksheet to clear certain cells. I have tried to create another reset button, yet when I do, it has the same cells listed to clear, but doesn't work. And when I make changes to one button, it changes the contents of both. How can I create two buttons on the same worksheet, but that clear different cells?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
If you ever have a script written that does not do what you want. You need to show us the script so we can see why it does not work.

And show us all the code you have in your sheet.
 
Upvote 0
If you ever have a script written that does not do what you want. You need to show us the script so we can see why it does not work.

And show us all the code you have in your sheet.
Screenshot%202019-03-02%2017.06.32.png
 
Upvote 0
I can't get a link for a picture to upload. And I don't know where to find the code that is causing this. All I have is the code that resets all of the cells, and I know that is not want you want. So, what next?
 
Upvote 0
Private Sub CommandButton3_Click()
Sheets("Calculate").Range("D29").Value = "Bus Type"
Sheets("Calculate").Range("D31").Value = "Bus Type"
Sheets("Calculate").Range("D33").Value = "Bus Type"
Sheets("Calculate").Range("F29").Value = ""
Sheets("Calculate").Range("H29").Value = ""
Sheets("Calculate").Range("J29").Value = ""
Sheets("Calculate").Range("L29").Value = ""
Sheets("Calculate").Range("O29").Value = ""
Sheets("Calculate").Range("R29").Value = ""
Sheets("Calculate").Range("F31").Value = ""
Sheets("Calculate").Range("H31").Value = ""
Sheets("Calculate").Range("J31").Value = ""
Sheets("Calculate").Range("L31").Value = ""
Sheets("Calculate").Range("O31").Value = ""
Sheets("Calculate").Range("R31").Value = ""
Sheets("Calculate").Range("F33").Value = ""
Sheets("Calculate").Range("H33").Value = ""
Sheets("Calculate").Range("J33").Value = ""
Sheets("Calculate").Range("L33").Value = ""
Sheets("Calculate").Range("O33").Value = ""
Sheets("Calculate").Range("R33").Value = ""
End Sub
Private Sub CommandButton2_Click()
End Sub
 
Upvote 0
You said:
I have created an Active x control reset button on a worksheet to clear certain cells.

So you created a Button and have code in it to clear cells but you do not know where the code is?

Right click on the Control and select view code if in developer mode.

Or right click on sheet tab and choose view code.

 
Upvote 0
Now you showed me your code:
Private Sub CommandButton2_Click()
'You need some code in here


End Sub

This button has nothing in it:

It cannot do anything if it has no code
 
Upvote 0
I have placed code under there, but then it affects all the buttons, not just one. What I want is three buttons on a single sheet. I want the first button to clear information in a certain set of cells, the second button to clear another specific set of cells, and then the third button to clear all cells on the sheet. The code I have listed is the code to clear once set of cells on the page. When I try to create a new button, the code is duplicated in the code, so all three buttons are clearing exactly the same thing, which is the everything I want deleted and not just the specific set of cells.
 
Upvote 0
So, and I've tried this, but I think I'm not separating them, naming them or differentiating between them properly for them to work. I have tried to place different code for clearing the cells, but either all the buttons clear the same thing, or one button works and the other two do not. Does the code for all three buttons show up in the same box? When I did this before, I had two different boxes pop up (one for each button), and they each had their own separate code.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top