Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ndx As Long
Dim TeamColor As Double, _
FontColor As Double, _
ColorVals As Variant
Ndx = WorksheetFunction.Match(Target.Value, Sheets("opponent").Range("A1:A30"), 0)
TeamColor = Worksheets("opponent").Cells(Ndx, 1).Interior.Color
FontColor = Worksheets("opponent").Cells(Ndx, 1).Font.Color
ColorVals = Split(rgb3(TeamColor), ",")
Range(Target.Address(0, 0)).Interior.Color = RGB(CLng(ColorVals(0)), CLng(ColorVals(1)), CLng(ColorVals(2)))
Range(Target.Address(0, 0)).Font.Color = FontColor
End Sub
and this from Marcol (2011?)
Public Function rgb3(ByVal ColorVal As Long) As String
Dim R As Long
Dim G As Long
Dim B As Long
Dim RGB As Long
R = ColorVal And 255
G = ColorVal \ 256 And 255
B = ColorVal \ 256 ^ 2 And 255
rgb3 = R & "," & G & "," & B
End Function
One last thing is on the Chicago Bulls tab. Cells B21:B35 have a data validation and the roster changes dynamically. I want to be able to hide cell B35 (or any other cell in that data validation range) if there is not an entry A21:A35.
1. Created named formula OpponentManList: " =IF('Chicago Bulls'!$A21<>"",temp) "
2. Created named range temp for range: $P$21:$37
3. Created conditional data validation in B21:B35: " =OpponentManList "
Bookmarks