+ Reply to Thread
Results 1 to 6 of 6

Add Value & Cell Color With Button

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Add Value & Cell Color With Button

    Hi guys, the following code clears contents in the Range given.

    Please Login or Register  to view this content.
    I need a code the will add the value, "activated" when the button is clicked
    to the given range.

    Next, Is a Toggle button a bottom that executes two commands?
    1st command with first click
    2nd command with 2nd click?

    if so, i really would like to make this a Toggle Button that will execute the
    the given range above and the on the 2nd click execute the range
    (H1,I1,J1,K1).

    A bonus would be to have the cells color turn red that are within the given range when executed.

    Any help is appreciated.

    Thanks,
    bdb
    Last edited by bdb1974; 05-07-2009 at 06:18 PM.

  2. #2
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Value & Cell Color With Button

    Hi guys,

    This is the closest I've come to what I'm looking for in addition to what I
    posted intially.

    The attachment shows button which will change the numerical value within a cell with each click. Basically, I want the action, but, I want the value to
    be a text value: "activated". I want this value to appear in C1,D1,F1,G1
    on the 1st click, on the 2nd click it should be removed w/no color, and appear in H1,I1,J1,K1 along with red in the cell color.
    Attached Files Attached Files

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

    Re: Add Value & Cell Color With Button

    First, you don't need to write a value into a cell to toggle through the colors. You can just test for the color that is there already and scroll to the next color in the sequence, like this:
    Please Login or Register  to view this content.
    Now, your current exercise...you start with 4 scrolling colors above, and now want to go to just one color? Can you demonstrate your desired results with more sample sheets in that workbook?
    _________________
    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!)

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Value & Cell Color With Button

    JBeaucaire,

    What I had before is closer to the desired result.
    I know, the value number of the color does not have to be written in order to display a color.

    To start off, I only need to use two colors (red&green)
    What I need is the text value/word: "activated" to appear
    in the cell when the color is green. I want it to state, "off" when the cell color is red. In conjuction of that happening, I want another cell to be controlled by the same button, but to display the opposite value each time the button is
    clicked. This will give me a toggle effect of changing the status of two cells
    simultaneously.

    Also, I prefer it not change an active cell. Instead, is should change 2 designated cells in row 1
    The 2 does not matter, I can customize this later.

    Thanks,

    bdb
    Last edited by bdb1974; 05-07-2009 at 03:35 PM.

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

    Re: Add Value & Cell Color With Button

    Like this?:
    Please Login or Register  to view this content.
    That's the code from a Control Toolbox Command Button.

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Value & Cell Color With Button

    Perfect!

    I can work with this.

    This does exactly what I need, I've adjusted the colors and the range
    to meet my needs. Thanks

    bdb

+ 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