Color de CELDAS segun condicion
Hola! Como haria con VBA, para que (segun lo que escriba en mi textbox1) UNICAMENTE las celdas en el rango "b3:n3" que tengan el valor del textbox1 al pulsar un commandbutton1 esas mismas celdas de se vuelvan de color azul???
intente usar:
.
Private Sub CommandButton1_Click()
On Error Resume Next
Application.DisplayAlerts = False
Sheets("programa").Range("b3:n40").Select
If Not Selection.Value = TextBox1.Value Then
With Selection.Interior
.ColorIndex = 7
.Pattern = xlSolid
End With
End If
If Selection.Value = TextBox1.Value Then
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
End sub
.
Pero no me funciono, esta me llena todo el rango del mismo color y yo solo kiero que sean las que tengan el valor del textbox1
intente usar:
.
Private Sub CommandButton1_Click()
On Error Resume Next
Application.DisplayAlerts = False
Sheets("programa").Range("b3:n40").Select
If Not Selection.Value = TextBox1.Value Then
With Selection.Interior
.ColorIndex = 7
.Pattern = xlSolid
End With
End If
If Selection.Value = TextBox1.Value Then
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
End sub
.
Pero no me funciono, esta me llena todo el rango del mismo color y yo solo kiero que sean las que tengan el valor del textbox1
2 Respuestas
Respuesta de vorkosigan
1
Respuesta de antares18
1