Hi, I have a few hours up my sleeve and I've set out to re-do my gantt chart excel template. The one I did up and have been using for a couple years now is overly complex with many, many hidden helper columns. It also has some annoying limitations which I would like to overcome in the new version. One of these limitations has always been the colour palette available. At the moment I only have a handful of predefined colours with a corresponding reference number. Cells in the chart section that fall between the start and finish range = the fill reference number by simple if statement calculation. I then have conditional formatting apply the fill based on the cell value. It works but it is clunky and limited to the range of pre-defined colours. It also requires a new conditional formatting rule for each fill colour which will get out of control quickly if I try to expand the pre-defined palette much. Another annoying aspect of this approach is that I have to keep a reference chart on the template so I can see what number to enter to get X colour.
OK, enough background..... A far more elegant solution would be to conditionally format the chart cells based on the fill colour I enter in column A (for instance, non-printing). In all me research it doesn't appear that excel has any inbuilt functions that can: 1)return the RGB value of fill in a cell, and 2)fill a cell based on the RGB value. I think this is VB territory here and I have seen several versions of VB code that are supposed to fill a cell. I haven't seen any that are designed to fill it based on the colour of another cell.
I assume also, as this has to be done using VB code, I will have to include the if statement to determine the range of cells to fill (>= cell1, <= cell2). Oh yah, the cells in the chart area contain a string which is used to conditionally format predecessor lines, borders, weekends, etc. So the font colour must be set by the code to match the fill colour (white by default). Something to consider, and I have no idea, is the order of priority: (VB formatting vs conditional formatting vs user formatting). VB formatting probably won't work if it entirely overwrites all conditional formatting. I will still have to use conditional formatting for cell borders on the same cells being filled by VB code.
I hope this isn't too confusing. I know it is a big ask but if anybody has the answers, I would be very grateful.
Cheers!
OK, enough background..... A far more elegant solution would be to conditionally format the chart cells based on the fill colour I enter in column A (for instance, non-printing). In all me research it doesn't appear that excel has any inbuilt functions that can: 1)return the RGB value of fill in a cell, and 2)fill a cell based on the RGB value. I think this is VB territory here and I have seen several versions of VB code that are supposed to fill a cell. I haven't seen any that are designed to fill it based on the colour of another cell.
I assume also, as this has to be done using VB code, I will have to include the if statement to determine the range of cells to fill (>= cell1, <= cell2). Oh yah, the cells in the chart area contain a string which is used to conditionally format predecessor lines, borders, weekends, etc. So the font colour must be set by the code to match the fill colour (white by default). Something to consider, and I have no idea, is the order of priority: (VB formatting vs conditional formatting vs user formatting). VB formatting probably won't work if it entirely overwrites all conditional formatting. I will still have to use conditional formatting for cell borders on the same cells being filled by VB code.
I hope this isn't too confusing. I know it is a big ask but if anybody has the answers, I would be very grateful.
Cheers!
Last edited: