Bloquear celdas una vez que termine de escribir en toda una fila

"Para Dante Amor"

Si ya tengo una macro que me ejecuta una tarea especifica y quisiera que a su vez parte de su funcionalidad sea que al ir llenando celda por celda de mi hoja de excel se vayan las mismas bloqueando, ¿es posible? ¿Cómo?

Sub CopiarDtos()
Set h1 = Sheets("Hoja1")
Set h2 = Sheets("Hoja2")
For i = 7 To h1.Range("B" & Rows.Count).End(xlUp).Row
If h1.Cells(i, "L") = "Válido" Then
For j = 7 To h2.Range("B" & Rows.Count).Row
If h2.Cells(j, "B") = "" Then
h2.Cells(j, "B") = h1.Cells(i, "C") 
h2.Cells(j, "C") = h1.Cells(i, "g") 
h2.Cells(j, "D") = h1.Cells(i, "ab") 
h2.Cells(j, "E") = h1.Cells(i, "aa") 
h2.Cells(j, "h") = h1.Cells(i, "i") 
h2.Cells(j, "I") = h1.Cells(i, "s") 
h2.Cells(j, "J") = h1.Cells(i, "U") 
h2.Cells(j, "k") = h1.Cells(i, "e") 
h2.Cells(j, "o") = h1.Cells(i, "d") 
h2.Cells(j, "P") = h1.Cells(i, "AG") 
Exit For
End If
Next
End If
Next
MsgBox "Hoja2 CARGADA"
End Sub

1 Respuesta

Respuesta

H o l  a:

Envíame un correo nuevo. Recuerda poner en el asunto tu nombre de usuario.

En el archivo me explicas con un ejemplo lo que necesitas.

H o l a:

Te anexo la macro para los eventos de tu hoja

Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
    If Target.Count > 100 Then Exit Sub
    If Not Intersect(Target, Range("C7:AG1006")) Is Nothing Then
        ActiveSheet.Unprotect "abc"
        For Each c In Target
            c.Locked = True
        Next
        ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
            False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
            AllowFormattingRows:=True, AllowInsertingHyperlinks:=True, AllowSorting:= _
            True, AllowFiltering:=True, AllowUsingPivotTables:=True
    End If
End Sub

' : )
'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias
' : )

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas