1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Dim LastLine As Long
LastLine = Range("a65536").End(xlUp).Row
For i = 6 To LastLine
If Not Application.Intersect(Target, Cells(i, 1)) Is Nothing Then
Cells(i, 2).Value = Year(Cells(i, 1).Value)
Cells(i, 3).Value = Month(Cells(i, 1).Value)
Cells(i, 4).Value = Day(Cells(i, 1).Value)
End If
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub |