Dim C11 As Range
If Intersect (Target, [A2: A21]) Is Nothing Then Exit Sub
For Each C11 In Intersect (Target, [A2: A21])
If IsEmpty (C11) Then
C11 .Offset (, 1) .ClearContents
Else
C11.Offset (, 1) = Date
End If
Next
End Sub
Private Sub Worksheet_Change (ByVal Target As Range)
Dim Cll As Range
If Intersect (Target, [A2: A6000]) Is Nothing Then Exit Sub
For Each Cll In Intersect (Target, [A2: A6000])
If IsEmpty (Cll) Then
Cll .Offset (, 1) .ClearContents
Else
Cll.Offset (, 1) = Date
End If
Next
End Sub
Step 3: Finally, you exit VBA and go back to the excel file you want to create automatically. Here when you enter data in column A, the current date is automatically entered into the corresponding cell on column B. So, when you enter the item data, the date entered is the current date entered automatically. to the Import date column .
Note: You can change the scope of data entry by modifying statements in the event Change of Worksheet .
Above are the basic ways to enter current date in excel. Depending on the work you choose for yourself the most reasonable way.
Good luck!