Results 1 to 3 of 3

Reset the value in a range

Threaded View

  1. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Reset the value in a range

    1. Click on View > Toolbars > Control Toolbox
    2. Find the Command Button icon and click on it
    3. Draw a button shape on your sheet with the mouse
    4. Right-click on the CommandButton1 that results and select Properties
    5. Find the Caption property in the left panel and change the text in the right panel to RESET GAME
    6. On the Control Toolbox Toolbar click on the Design Mode icon (this turns off macros temporarily and lets you edit them)
    7. Right-click on the RESET GAME button and select View Code, the VBEditor will open
    8. Insert this line of code in empty white space in between the sub flags:
      Private Sub CommandButton1_Click()
      
          Range("A1:A3,B12,D4:G18,H20").ClearContents
          
      End Sub
      From this code you can see how to list the cells to clear...
    9. Edit the cell references to complete the list for your sheet
    10. Press Alt-Q to close the VBEditor
    11. Click on the Design Mode icon to revert to normal mode
    12. Save your sheet
    Your new button is ready to use.
    Last edited by JBeaucaire; 04-27-2009 at 09:21 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1