Select case cambie de color un label al pasar valores determinados

Para dante o adriel

Hola aplicando el conteo de caracteres quisiera añadirle un detalle más

Que seria esto pero no se que estoy haciendo mal, me gustaría que me ayuden con el código a corregirlo y explicándome en que estoy mal por favor

Es este lo puse en el textbox1 en modo change

Private Sub TextBox7_Change()
Label9 = Len(TextBox7)
If Label9.Caption >= 1 Then
Label10.Caption = "Numero de Caracteres"
Else
Label10.Caption = Empty
End If
Dim NUMERO As Integer
NUMERO = Label9.Caption
Select Case NUMERO
Case Label9.Caption < 35
Label9.ForeColor = RGB(0, 255, 0)
Case Label9.Caption > 35
Label9.ForeColor = RGB(255, 255, 0)
Case Label9.Caption = 65
Label9.ForeColor = RGB(255, 0, 0)
End Select
End Sub

1 Respuesta

Respuesta
1

[Hola 

te paso la macro actualizada

Private Sub TextBox7_Change()
Label9 = Len(TextBox7)
If Label9.Caption >= 1 Then
Label10.Caption = "Numero de Caracteres"
Else
Label10.Caption = Empty
End If
'
Dim NUMERO As Integer
NUMERO = Label9.Caption
'
Select Case NUMERO
Case Is < 35
    Label9.ForeColor = vbGreen
Case 35 To 64
    Label9.ForeColor = vbRed
Case 65
    Label9.ForeColor = vbBlue
End Select
'
End Sub

QUE hice mal mi estimado?¡

Observa en esta línea

1......Select Case NUMERO
2... Case Label9. Caption < 35

Evaluamos "NUMERO" en la primera línea, en la segunda ya no de ir.

aquí hay información de la sintaxis de select case.

https://msdn.microsoft.com/en-us/library/cy37t14y.aspx 

Valora para finalizar saludos!

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas