Você precisa mover o código do evento Workbook_Open()
no evento Worksheet_Change()
Certifique-se também de usar Option Explicit
em todos os módulos
Coloque isso no módulo Folha VBA. Ele será acionado somente quando as células na coluna C forem atualizadas
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge = 1 Then 'Check that only 1 cell is being edited
If Len(Target) > 0 Then 'Make sure the cell is not empty
With Target
If .Row > 1 And .Column = 3 Then 'Exclude Header row, and act on col 3
OptimizeApp True
MovePropRow Target
OptimizeApp False
End If
End With
End If
End If
End Sub
Private Sub MovePropRow(ByVal Target As Range)
Dim ws As Worksheet: Set ws = Target.Parent
Dim lr As Long: lr = Target.Row
Dim lrProp As Long: lrProp = ws.Cells(ws.Rows.Count, "D").End(xlUp).Row
If lrProp = lr Then
ws.Range(ws.Cells(lr, "D"), ws.Cells(lr, "I")).Copy
ws.Cells(lr + 1, "D").PasteSpecial xlPasteAll
ws.Range(ws.Cells(lr, "D"), ws.Cells(lr, "I")).Clear
Target.Select
End If
End Sub
Private Sub OptimizeApp(ByVal speedUp As Boolean)
Application.Calculation = IIf(speedUp, xlCalculationManual, xlCalculationAutomatic)
Application.ScreenUpdating = Not speedUp
Application.DisplayAlerts = Not speedUp
Application.EnableEvents = Not speedUp
End Sub
Teste Sheet3
- Before
TesteSheet3
-After
(typing"x" in Cell "C10")