I have the following VBA code in Excel which works fine
Sub Change_Color()
Color_TextBox4 = RGB(255, 255, 0)
Sheet03.Shapes("TextBox4").Select
With Selection.ShapeRange.Fill
.ForeColor.RGB = Color_TextBox4
End With
End Sub
However, I want that "Color_TextBox4" should source the color code from a cell in my Workbook as per below
Color_TextBox4 = Sheet03.Range("H1").Value`
Note: The text in cell H1 in Sheet03 = RGB(255, 255, 0)
The code then looks like
Sub Change_Color()
Color_TextBox4 = Sheet03.Range("H1").Value
Sheet03.Shapes("TextBox4").Select
With Selection.ShapeRange.Fill
.ForeColor.RGB = Color_TextBox4
End With
End Sub
But when I run the code I get an error message
"Run-time error '13':
Type mismatch"
Do I need to declare/set "Color_TextBox4" in any specific way to make it work? Or what other changes do I need to do?
RGBfunction. Try to useEvaluate()to convert it to a number value.255,255,000. Then theEvaluatefunction is something like thiscolor_textbox4 = Evaluate("left(H1,3)+mid(h1,5,3)*256+right(h1,3)*256*256")`