Excel. Macro para resaltar en rojo las filas que contengan el valor de un TextBox (Userform)
"Para Dante Amor"
Hola, gracias por tus respuestas y ayuda. Como me indicaste, aquí te realizo la pregunta del problema que noté el día de hoy en el código que me enviaste anteriormente. El código funciona perfectamente y hace justo lo quería (que me resaltara en rojo la fila que tuviera el valor que indicaba en el TextBox1 y le colocara la palabra "ANULADA" en las 3 hojas, ya que solo lograba que lo hiciera en 1 sola) pero me di cuenta que me resalta en rojo y coloca la palabra "ANULADA" solo en la primera fila que contiene el valor, o sea, si hay más filas con ese valor no las resalta y me pasa lo mismo en las 3 hojas. Aquí te coloco el código:
Private Sub anular_Click()
'Act.Por.Dante Amor
Set h = Sheets("BASE DE DATOS FACTURACION")
h.Unprotect ("12345")
Set b = h.Range("C:C").Find(Trim(TextBox1.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not b Is Nothing Then
h.Range("A" & b.Row & ":O" & b.Row).Interior.Color = vbRed
h.Range("O" & b.Row) = "ANULADA"
End If
h.Protect ("12345")
'
Set h = Sheets("BASE DE DATOS")
h.Unprotect ("12345")
Set b = h.Range("C:C").Find(Trim(TextBox1.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not b Is Nothing Then
h.Range("A" & b.Row & ":M" & b.Row).Interior.Color = vbRed
h.Range("M" & b.Row) = "ANULADA"
End If
h.Protect ("12345")
'
Set h = Sheets("MOVIMIENTOS DE INVENTARIO")
h.Unprotect ("12345")
Set b = h.Range("F:F").Find(Trim(TextBox1.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not b Is Nothing Then
h.Range("A" & b.Row & ":G" & b.Row).Interior.Color = vbRed
h.Range("G" & b.Row) = "ANULADA"
End If
h. Protect ("12345")
Unload Me
End Sub
1 Respuesta
Respuesta de Dante Amor
2