First time post. Please excuse any indiscretions.
' I want to set Selection.Font.Color using RGB values, which are stored in a cell in a different worksheet ( e.g., RGB(0, 102, 204) )
' Here is some of the code
Dim DataWorksheet as String
Dim SelectionFontColorCell As String
Dim SelectionFontColor As String
Dim TeamColumn As String
DataWorksheet = "International"
SelectionFontColorCell = TeamColumn & "42" ' contains the text "RGB(0, 102, 204)"
SelectionFontColor = Range(DataWorksheet & "!" & SelectionFontColorCell).Value
' SelectionFontColor is now "RGB(0, 102, 204)", without the quotes
' "RGB(0, 102, 204)" is the same as Hexadecimal "&HCC6600"
' Change font color for the Name I am writing to a particular cell
Selection.Font.Color = SelectionFontColor ' This fails
SelectionFontColor = RGB(0, 102, 204) ' This works
' If SelectionFontColorCell contains the text "&HCC6600", then the following works:
Selection.Font.Color = SelectionFontColor ' This works
The error I receive is "Run time error (13): Type mismatch".
I don't know how to resolve the issue.
Any/all help is appreciated.
Many thanks!
' I want to set Selection.Font.Color using RGB values, which are stored in a cell in a different worksheet ( e.g., RGB(0, 102, 204) )
' Here is some of the code
Dim DataWorksheet as String
Dim SelectionFontColorCell As String
Dim SelectionFontColor As String
Dim TeamColumn As String
DataWorksheet = "International"
SelectionFontColorCell = TeamColumn & "42" ' contains the text "RGB(0, 102, 204)"
SelectionFontColor = Range(DataWorksheet & "!" & SelectionFontColorCell).Value
' SelectionFontColor is now "RGB(0, 102, 204)", without the quotes
' "RGB(0, 102, 204)" is the same as Hexadecimal "&HCC6600"
' Change font color for the Name I am writing to a particular cell
Selection.Font.Color = SelectionFontColor ' This fails
SelectionFontColor = RGB(0, 102, 204) ' This works
' If SelectionFontColorCell contains the text "&HCC6600", then the following works:
Selection.Font.Color = SelectionFontColor ' This works
The error I receive is "Run time error (13): Type mismatch".
I don't know how to resolve the issue.
Any/all help is appreciated.
Many thanks!