+ Reply to Thread
Results 1 to 11 of 11

creating a reset button for selected cells

Hybrid View

  1. #1
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Smile creating a reset button for selected cells

    I am new here and have a little exp with xls2003 and there is probably a simple way to do this, but after looking through FAQ's couldn't find exactly what I needed.

    Have a simple worksheet that i use for bidding jobs and i just want to add a reset button at the top to clear all the cells that i have entered quantities for specific material items.

    I did a macro, but I didn't like the way it 'jerked' around the page mimmicking every page movement that I made selecting the cells that needed to be reset. Currently do not have any cells locked (like the type of material, price, etc).

    Thanks in advance,

    Mark
    Last edited by MR64; 10-12-2011 at 08:57 AM.

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: creating a reset button for selected cells

    Attach a sample workbook. You'll get faster response.
    There are ways to turn off the screenupdating that will stop the movements.
    modytrane

  3. #3
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: creating a reset button for selected cells

    made some progress. added the code for the ranges I want to reset, but when I try to add any more cells it keeps saying there is a bug. I actually had to add a section of ranges at a time and continue to try it for it to work, could not get it to accept all the cells at first.
    The highlighted acqua sections (Qnty) are the area I want to reset.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: creating a reset button for selected cells

    see attached workbook.
    The easiest approach would be if you fill all of the qty. cells with the same color.
    Enter some values in qty. and click the "Reset" button.
    All cells with the same color will be reset.
    Simple macro [see below], checks for color of the cells and resets all cells with that color.
    This way you don't have to add anything to the macro.
    modytrane.

    Sub resetcells()
    
    
    Application.ScreenUpdating = False
    
     For Each c In ActiveSheet.Range("A1:AZ1000").Cells
            If c.Interior.Color = 16777164 Then c.ClearContents
        Next
    
    
    Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: creating a reset button for selected cells

    Modytrane thanks....I like the idea of using color to select, seems easier to me. I tried opening the file you atttached but wouldn't 'convert' for some reason, that was the message I got anyway, so I could not see your example. Would this code above (with the right color # ) be inserted the way it is now or be in addition to 'Private Subcommand....... ' Tried just copying and posting the code above and was getting error message.....where do I get the color #? What I have used in the past are codes like #52F3FF or something like that.

    Thanks for the patience, I am not a programmer but like manipulating excel...your help is appreciated.


    Is there another way to open your example?
    Mark
    Last edited by shg; 10-03-2011 at 04:10 PM. Reason: deleted quote

  6. #6
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: creating a reset button for selected cells

    Here's the same file saved in XL2003.
    Hopefully you'll be bale to open this.
    modytrane
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: creating a reset button for selected cells

    That will work perfectly once i figure some things out:

    1. how come I cannot click on design mode, dclick button and bring up the code editor box? I was able to do so with the 'command' button i first established, but not with your 'reset' button.
    2. tried copying the code from this page and putting a button on another sheet but did not have anything happen.
    why would that be? same code, colors etc
    3. how do i get the color #'s if I'm changing to different cell colors?

    Thanks Mark

  8. #8
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: creating a reset button for selected cells

    see attached file.
    I was able to copy the button on next sheet and it still works.
    I created sheet3 where you can fill cell E6 with a color, click the code button and it will show you the color code in F6.
    hope this works for you.
    Otherwise the issue could be that I am working with XL2007 and saving the file as XL2003.
    So in the process of converting, something is getting lost.
    You should be able to write the same codes and make it work.
    modytrane.

    Here's the code for identifying color codes.

    Sub Button1_Click()
    
    ActiveSheet.Range("F6").Value = Range("E6").Interior.Color
    
    End Sub
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Smile Re: creating a reset button for selected cells

    modytrane thank you very much for all your help. I will try that tonight and let you know how it goes.

    Mark

  10. #10
    Registered User
    Join Date
    09-30-2011
    Location
    missouri
    MS-Off Ver
    Excel 2010
    Posts
    8

    Smile Re: creating a reset button for selected cells

    modytrane.....that is exactly what I needed. Copied fine and works great, you made that real simple, thank you so much, I really do appreciate it.

    Mark

  11. #11
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: creating a reset button for selected cells

    If you are satisfied with the solution, please mark the thread "SOLVED".
    Thank You,
    modytrane

+ Reply to Thread

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