Multiple conditional formats, but based on the contents of another cell...

  • Hi,


    I’m a competent Excel user, but I know only a very little about VBA programming. The difficulty I'm having concerns the conditional formatting function of Excel. A simplified explanation of the problem is I have a spreadsheet where the format of cell A2 depends on the value in the cell A3. I have 10 possible options for the formatting of background/borders. Thus I need more that the 3 (or 4 if you include the base format) conditional format options that excel offers. Is there a piece of VBA code I can paste into the 'View Code' view in my spreadsheet to help sort this? I've searched this web site for an answer to this and although there seem to be many solutions based on the contents of the cell to be conditionally formatted, there are few based on the contents of another cell from that to be formatted. I need multiple options based on the "formula is" rather than the "cell value is" functionality of the conditional formatting tool.


    I've attached an example of the problem I have, and showing the 10 possible options I'm after.


    Any help would be most greatly appreciated.


    Kind regards
    Rob

  • Re: Multiple conditional formats, but based on the contents of another cell...


    Hi Rob,


    Welcome to the forum.


    This is a very common requirement and has been answered many a times in this forum. Please try a search on 'conditional formating' and you will get the desired result. Had any difficulty in adopting the code, post back with details.


    HTH

  • Re: Multiple conditional formats, but based on the contents of another cell...


    Welcome to OzGrid


    Dave also has posted the following sample code.



    THis code can be found with other useful VBA samples in Dave's VBA Tips and Tricks link from the OzGrid Home Page.


    http://www.ozgrid.com/VBA/default.htm


    The specific link that includes the above code (a ways down the page) is:


    http://www.ozgrid.com/VBA/ExcelWorkbookEvents.htm

  • Re: Multiple conditional formats, but based on the contents of another cell...


    Hi,


    Thanks for the advice - but I did a search previous to my posting and I can't find a solution. The examples given seem to relate to the contents of the cell to be formatted, (i.e.enter "3" in cell A1 and the background goes yellow) not the contents of another cell (I need to enter "3" in cell A1 and cell B2 background goes yellow). I need 10 different options. I'm sure that it only needs some minor modification of the VBA code, but not knowing VBA I don't know what this is. Please help if you can...


    Many thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!