PDA

View Full Version : add date to the column during update in worksheet



klpw
01-19-2016, 09:26 PM
Hi all,

I've had a database worksheet and I was wondering how to automatically add date to first column when there is new column or new row added by user?


Cheers

SamT
01-19-2016, 10:05 PM
Cells(RowNumber, ColumnNumber) = Date

klpw
01-20-2016, 02:14 AM
Hi SamT,

In my case, when I add anything in column C, it will show "Date" in Column D, may I know how could I make the "Date" show in Column B instead?


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

If Not Intersect(Target, Range("C2:C100")) Is Nothing Then

With Target(1, -2)

.Value = "Date"

.EntireColumn.AutoFit

End With

End If

klpw
01-20-2016, 02:23 AM
Sorry, the code With Target line should be #With Target(1, 2)#