I want to set the fill colour of a shape using HEX so I have
selCellColour=ActiveCell.DisplayFormat.Interior.ColorTo get the colour of the cell and want to use
ActiveSheet.Shapes("Test").Fill.ForeColor = Hex(selCellColour)But I keep getting the a Type Mismatch error message. How can I resolve this, I don't want to colour to RGB I want to use the HEX value.
31 Answer
The ForeColor property of a Shape's Fill is of type ColorFormat. ColorFormat can only be assigned an RGB or a color in the color scheme.
Per the ColorFormat page:
You can set colors to an explicit red-green-blue value (by using the RGB property) or to a color in the color scheme (by using the SchemeColor property).
So, if you don't prefer RGB, you could explore the color scheme method.