Vladut
Vladut

Reputation: 657

How put date in Column A when i fill a cell in column B? Excel

i have that problem, when a guy complete cell 1 from column B i want to put date now in Column A, cell 1. If i save excel I want to save date, if i open tomorrow to save date from the last day but when complete Column B, row 2, put date from the current date without change date from Column A, row 1. Like in picture:

enter image description here

Ex: if i complete in Column B, row 6, put current date in Column A, row 6, without change other dates.

Thanks

Upvotes: 1

Views: 92

Answers (1)

adamc-au
adamc-au

Reputation: 215

Only way I know of that you can do this is with some VBA code.

Select the sheet that you want to automate and press ALT + F11 to go to the VBA editor, then you could use some code like this

Private Sub Worksheet_Change(ByVal Target As Range)

If (Target.Column = 2) Then ' Check if in 2nd Column ie. Column B
    If Target.Offset(, -1).Value = "" Then ' Check if there is already a value in Column A
        Target.Offset(, -1).Value = Date ' No value, lets stick in the current system date
    End If
End If

End Sub

Problem with this code is it will run for every cell change and on a large workbook might slow things down a bit.

Upvotes: 1

Related Questions