Command Button To Reset Values to 0.00

CDG306

New Member
Joined
May 14, 2019
Messages
6
I am trying to figure out a code to reset about 10 columns of data back to 0.00 without wiping out the formulas contained in a few of the cells. Would I be better off just making a command to set specific values for each cell and copying in the formula there? Thanks in advance.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Figured it out. This worked for what I was needing in to.

Private Sub CommandButton1_Click()
Range("C3").Value = "0.00"
Range("C4").Value = "0.00"
Range("C5").Value = "=SUM(C3-C4)"
Range("C6").Value = "0.00"
Range("C7").Value = "0.00"
Range("C8").Value = "0.00"
Range("C9").Value = "0.00"
Range("C10").Value = "0.00"
Range("C11").Value = "0.00"
Range("C12").Value = "0.00"
Range("C13").Value = "=SUM(C5:C11)"
Range("C14").Value = "0.00"
Range("C15").Value = "=SUM(C12-C13)"
Range("C17").Value = "0.00"
End Sub
 
Upvote 0
Formulas are dynamic, no need to reset them.
You can do this with one line of code:
Code:
Private Sub CommandButton1_Click()
    Range("C3:C4, C6:C12, C14:C14, C17:C17").Value = 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,834
Members
449,471
Latest member
lachbee

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