I am creating many userforms for a project and I want to have a common color theme. And I created a column that has all the colors I want to use.
So instead of having to say Label1.ForeColor= RGB(0,0,0) in each userform, I want to be able to just reference that cell that has the color information. So if the color scheme changes and I want to change RGB(0,0,0) to RGB(23, 100,200), I can just change it in one place instead of having to change the label colors in all the userforms.
I additionally created a named range for each cell in the the column KT, because I thought I could reference named ranges easily to get the values. Here is my current code:
However, it throws a TypeMismatch error because it sets Label1.ForeColor = "RGB(0,112,255)" and I think it reads it as a string. How do I get it to remove the quotes? And have Sheet1.Range("HeaderColor").value not return a string, or somehow have it to be a compatible type?
Please help, TIA
So instead of having to say Label1.ForeColor= RGB(0,0,0) in each userform, I want to be able to just reference that cell that has the color information. So if the color scheme changes and I want to change RGB(0,0,0) to RGB(23, 100,200), I can just change it in one place instead of having to change the label colors in all the userforms.
I additionally created a named range for each cell in the the column KT, because I thought I could reference named ranges easily to get the values. Here is my current code:
VBA Code:
Label1.ForeColor= Sheet1.Range("HeaderColor").value 'In this case, HeaderColor references the named range I created just for that one cell in the 6th row of column KT
However, it throws a TypeMismatch error because it sets Label1.ForeColor = "RGB(0,112,255)" and I think it reads it as a string. How do I get it to remove the quotes? And have Sheet1.Range("HeaderColor").value not return a string, or somehow have it to be a compatible type?
Please help, TIA