Forum Discussion
Color a cell the same as another cell's fill color
The only way you might pull this off is by using a macro. Note you will have to adjust the cell range "D1:E2" to match yours:
Sub ColorRegionFromFormulas()
Dim cl As Range
Dim sourceCell As Range
Application.ScreenUpdating = False
For Each cl In Range("D1:E2")
cl.Select 'Necessary!
Application.Goto Evaluate(cl.Formula2)
With cl.Interior
.Color = ActiveCell.Interior.Color 'In case it isn't a themed color
On Error Resume Next
.Pattern = ActiveCell.Interior.Pattern
.PatternColorIndex = ActiveCell.Interior.PatternColorIndex
.ThemeColor = ActiveCell.Interior.ThemeColor
.TintAndShade = ActiveCell.Interior.TintAndShade
.PatternTintAndShade = ActiveCell.Interior.PatternTintAndShade
End With
Next
End Sub
Greetings,
Thanks for the responses. As a few of you had stated, using a macro adds a level of complexity that I don't really want to get into along with having to run the macros each time an update is made. Currently, when I print off each week's schedule, I just need to change the Week name field to the current week and print the schedule. Using macros would require running the macro every time.
I did find a solution on my own. I installed the Real Statistics resource pack and used the FillColor function to populate a cell outside of the printable page for each team entry in the schedule with the color of the team number for that week and match.
Team # cell = INDEX(sched_north,$R4,$S4)
Fill Color = FillColor(INDEX(sched_north,$R4,$S4),TRUE) ; populates into T4-24, U4-24, V4-24 and W4-24
I then created conditional formating rules using a formula to apply a formatting color:
$T4="yellow" ; apply the fill color yellow
I needed to create conditional formatting rules for each color (five different colors). I then needed to copy these five rules for each column in the schedule (four columns) referencing T4-27, U4-27, V4-27 and W4-27. This was a little cumbersome but using Format Painter to copy the rules for the columns made it quicker.
I didn't like having to polulate a cell with each fill color and reference that with the conditional formatting rules, but since I couldn't use the FillColor function in the conditional formating rules, this was the only way to get it to work.
I tried to post a section of the spreadsheet in here even after copying and pasting as values, but I got a huge list of HTML errors.
Again, thanks for the replies.
---RWR