[quote user="Barry Lothian"]The problem is I have hard-coded the textbox object name[/quote]
As Jan writes, you don't need to do that. You know which control invoked your subroutine: TB_CustomRed, TB_CustomBlue or TB_CustomGreen. Write your subroutine as Private
Sub ValidateRGB(ByVal value As String)
and pass it the value of whichever text box.
VBA Logical Expression Evaluation
[quote user="Barry Lothian"]If
Not
IsNumeric(.Value)
And
.Value <> vbNullString
Then
[/quote]
Unlike most other computer languages, VBA evaluates all expressions in a logical statement. In your case, it's possible to have an empty string that may cause IsNumeric(.Value) to throw an error. The following avoids that error...
If .Value <> vbNullString Then If IsNumeric(.Value) Then Dim number As Double number = Dbl(.Value) Else ' Not numeric End If Else ' Empty string End If