Creating a reset button

juniablo -  
Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   -
Hello everyone,
I’m reaching out to you once again for help because I don’t know how to solve my issue since I’ve never done this before. I’m doing some research but in the meantime, please give me a solution.
So, I have a form attached in which I need to create a reset button that will set all the fields in the table to 0 after use when I click on it. I kindly ask you to explain to me in detail the different steps (how to create the button, how the back-end requests work). Thank you so much for helping me.
http://cjoint.com/?DFnk1mYhyD9

4 answers

benol3 Posted messages 718 Status Member 87
 
Hi,

We need more information.

Which fields do you want to reset to 0?
0
juniablo
 
I want all the fields to be set to 0. Let me explain, let's say I enter information (capacity, distance, site...), once I'm done entering the information, the button after clicking should reset everything to 0 to allow another person to enter their info without any problem and without having to manually set it to 0, which would take some time. I hope I was more explicit.
Thank you in advance, I am still waiting.
0
juniablo
 
Otherwise, I prefer to automatically set the fields (site, capacity, and actual distance) to 0. I think that with these three, the others will also be set to 0 automatically.
So let's apply the button to the fields (sites, capacities, actual distance).
0
benol3 Posted messages 718 Status Member 87
 
When you say 0? Is it the value 0 or is it returning the field empty?
0
juniablo
 
in the cell capacity and real distance, it should show the value 0, and in the site cell, it should be empty.
0
benol3 Posted messages 718 Status Member 87
 
0
juniablo
 
Hello benol3, I saw your example but you can see that the displayed results are #N/A and when entering values the result is still #N/A, which is not correct. If you could show me your method in detail, maybe I could also get an idea of how you applied the formulas. Thank you for your help, I am waiting.
0
benol3 Posted messages 718 Status Member 87
 
The "Reset" button is a macro that clears the range A2:C11. If you want to see the code, press alt+F11. It's a very simple VBA code.

To remove the #N/A errors, you need to modify all your formulas by adding the IFERROR function.

For example, in D2, the formula: =VLOOKUP(C:C, Sheet5!A:B, 2,) becomes =IFERROR(VLOOKUP(C:C, Sheet5!A:B, 2,), "")
0
juniablo
 
Ok, I see, but if I ever want to do it again in another workbook, how can you coach (guide) me through the different steps? Thank you.
0
benol3 Posted messages 718 Status Member 87
 
It all depends on what you want to do...

If it's in the same format as your file, you just need to take the formulas and the VBA code that have already been created and adapt them to your case.
0
Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
 
Hello,

Check your file in return, I also modified your Internet sheet formulas

https://www.cjoint.com/?DFnoJXjuWBT

I think it would be wise to create a msgbox to confirm deletion to avoid accidental deletion

https://www.cjoint.com/?DFnoQ3BUi6F

See you
Mike-31

A period of failure is a perfect moment to sow the seeds of knowledge.
0
juniablo
 
WHY modify the formulas. this modification has errors. did you see the results when you enter values or set to zero. I prefer to use my formulas. all I want is how to create the Reset button to set to zero without changing anything to avoid manually setting all the cells to zero. I want automation. thank you for your help, I am waiting.
0
Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
 
Re,

No, modifying the formulas cannot lead to any error. For example, if we take your formula in cell G2
=VLOOKUP(B:B, detail!C:E, 3,), if the conditions are not met, the formula returns #N/A which is an error message. All formulas that result from this formula will automatically be in error

I simply added =IF(AND(B2="";C2="");""; which tests the cells that are the source of the formula to display nothing if the conditions are not met, which is more logical and more pleasant as well. Alternatively, displaying a zero =IF(AND(B2="";C2="");0;

but under no circumstances can there be an error at this point
--
Talk soon
Mike-31

A period of failure is a perfect time to sow the seeds of knowledge.
0