En esta macro, rectificar el cambio de letra y color de la celda

Tengo esta macro creada por Dante Amor, que me va perfecta:

Pero me interesaría que cuando vuelvo a escribir en la columna "D", que me la pone en negrita en el Range("A10:E60000") solamente en la línea que escribo.
Me la ponga también e la letra en blanco
Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
If Not Intersect(Target, Range("A10:E60000")) Is Nothing Then
For Each c In Target
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="1"
If Not Intersect(c, Range("D10:D600")) Is Nothing Then
If Range("B" & c.Row) = "" Then fbold = False Else fbold = True
Range("B" & c.Row) = Date - 1
Range("B" & c.Row & ":E" & c.Row).Font.Bold = fbold
End If
c.Value = UCase(c.Value)
Application.EnableEvents = True
Next
ActiveSheet.Protect Password:="1"
End If
End Sub

Pero me interesaría que cuando vuelvo a escribir en la columna "D", que me la pone en negrita en el Range("A10:E60000") solamente en la línea que escribo, como esta en la macro.
Me la ponga también la letra en blanco con negrita y las celdas en rojo.
Si se puede.

1 Respuesta

Respuesta
1

H o l a:

Te anexo 2 opciones para que pruebes cuál es la que necesitas

Prueba con esta opción

Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
    If Not Intersect(Target, Range("A10:E60000")) Is Nothing Then
        Application.EnableEvents = False
        ActiveSheet.Unprotect Password:="1"
        For Each c In Target
            If Not Intersect(c, Range("D10:D600")) Is Nothing Then
                If Range("B" & c.Row) <> "" Then
                    Range("B" & c.Row & ":E" & c.Row).Interior.ColorIndex = 3
                    Range("B" & c.Row & ":E" & c.Row).Font.ColorIndex = 2
                End If
                If Range("B" & c.Row) = "" Then fbold = False Else fbold = True
                Range("B" & c.Row) = Date - 1
                Range("B" & c.Row & ":E" & c.Row).Font.Bold = fbold
            End If
            c.Value = UCase(c.Value)
        Next
        Application.EnableEvents = True
        ActiveSheet.Protect Password:="1"
    End If
End Sub

O con esta opción :

Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
    If Not Intersect(Target, Range("A10:E60000")) Is Nothing Then
        Application.EnableEvents = False
        ActiveSheet.Unprotect Password:="1"
        For Each c In Target
            If Not Intersect(c, Range("D10:D600")) Is Nothing Then
                If Range("B" & c.Row) = "" Then fbold = False Else fbold = True
                Range("B" & c.Row) = Date - 1
                Range("B" & c.Row & ":E" & c.Row).Font.Bold = fbold
                Range("B" & c.Row & ":E" & c.Row).Interior.ColorIndex = 3
                Range("B" & c.Row & ":E" & c.Row).Font.ColorIndex = 2
            End If
            c.Value = UCase(c.Value)
        Next
        Application.EnableEvents = True
        ActiveSheet.Protect Password:="1"
    End If
End Sub

S a l u d o s

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas