Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Button to reset form values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
propolis - 28 Jan 2006 15:15 GMT
Hi,

I have entered some coding so that when my spreadsheet open, all user
values are set to zero (default values).

How do I add a button to my worksheet for the user to click on to reset
the values to there defaults while working on that sheet

:)

Signature

propolis

Dave Peterson - 28 Jan 2006 16:51 GMT
I'd create a named range and then just clear the cells in that named range.

Select your range of cells that should be cleared.
Insert|Name|Define|
and give it a nice name (I'll call it Input).

Then create a macro like this:

option Explicit
sub ClearInput()
 worksheets("sheet1").range("Input").value = 0
end sub

The plop a button from the Forms toolbar and assign that macro to the button.

In fact, I think I'd verify the request just in case:

option Explicit
sub ClearInput()
 Dim resp as long
 resp = msgbox(Prompt:="Are you sure you want to reset to defaults?", _
                buttons:=vbyesno)
 if resp = vbno then
    exit sub
 end if
 worksheets("sheet1").range("Input").value = 0
end sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

> Hi,
>
[quoted text clipped - 11 lines]
> propolis's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=5044
> View this thread: http://www.excelforum.com/showthread.php?threadid=506012

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.