+ Reply to Thread
Results 1 to 6 of 6

Change color of commandbuttons based in cell values

  1. #1
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142

    Change color of commandbuttons based in cell values

    Hi
    I would like to change the color of a set of commands buttons based in a cell value Fail(red) Pass(green)

    I have a main sheet with all the commandbuttos (one for each Item) in the real sheet I have more than 3 items that is the reason I would like to create something like the followint code

    then for each Item I have a sheet and in each sheet has a validation cell to choose pass or fail.
    But I get an error every time that the main sheet is activate and call the IpdateItemStatus sub
    Any help?
    Many thanks

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 08-17-2008 at 03:08 AM.

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Your fault is because you haven't qualified the ButtonName because Excel doesn't know which button!

    Rather than
    Please Login or Register  to view this content.
    you should use
    Please Login or Register  to view this content.
    Not all forums are the same - seek and you shall find

  3. #3
    Forum Contributor
    Join Date
    07-01-2008
    Location
    Cincinnati, OH
    Posts
    150
    Hi MMF.

    Please provide some more details. Your code contains quite a few errors. Post an example of your file or walk us through by describing which user actions should result in an update of some certain commandbutton's properties. Where are the commandbuttons in relation to the cells containing the conditions? What action results in a condition being changed? Perhaps we could automate this using the worksheet change event...

    ItemSheetName does not recieve an assignment.
    SheetName is never declared.
    Placing option explicit at the top of your modules will require variable declaration.

  4. #4
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    Sorry for that, here I am posting the excel sheet with explanation of what I am trying to do.
    many thanks and Best Regards
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    Hi Simon I was trying this
    Please Login or Register  to view this content.
    but still not working
    I think is because ButtonName is declared as a string, but I do not know how should I declare it in order to be accepted as a command button.

    Any further help will be welcomed

    Regards
    MMf

  6. #6
    Forum Contributor
    Join Date
    07-01-2008
    Location
    Cincinnati, OH
    Posts
    150
    Sorry for the delay but I have not been able to get to this site. I kept ending up at godaddy.com.

    Anyway, replace all of the code in your example with this code located in the workbook class...

    Name the PassFail ranges according to the button it relates to. See the attached.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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