Reset button in my spreadsheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want a button in my spreadsheet that will allow me to reset to zero or
clear the contents of certain cells in a calculator I created .... how do i
do this? Is there a formula in VB i can use (can't seem to get clearcontents
to work)?

Thanks

GT
 
I'm assuming the calculator is not a form. When you place the button on the
sheet double click it to get to the code behind it and just set the values of
the cells you want with cells("row","column")
cells(1,1)=0
That sets cell A1 to 0
cells(3,5)=""
Double quotes set blanks so cell E3 would be cleared.
 
To add a button to a worksheet go to View Menu - Toolbars - Control Tool box.
Add Command button to worksheet. Double click button to start macro. Go
back to worksheet a press on Toolbar properties. Change caption from
commandbutton to what evver you like. Exit design mode on toolbar to start
using the button.

use Range("A3:B7).clearcontents
 
Start recording a macro
select the cells that get 0's
type 0 and hit ctrl-enter
(continue recording)
select the cells that get cleared
hit the delete key
stop recording the macro

Add a button from the Forms toolbar to a nice location. Assign the macro you
just recorded to this button.
 
Back
Top