Date Update

N

Nigel

I have a spreadsheet in which I type information after contacting a client.
Next to this cell I put the date that I contacted that client. I often have
to contact the same client and overtype the information that was previously
in that cell. Is there a way to automatically update the date after I
overtype their information so that it shows when I last contacted that client?

Any help would be appreciated.

Thanks
 
A

Andy Brown

Nigel said:
I have a spreadsheet in which I type information after contacting a client.
Next to this cell I put the date that I contacted that client. I often
have
to contact the same client and overtype the information that was
previously
in that cell. Is there a way to automatically update the date after I
overtype their information so that it shows when I last contacted that
client?

You could do this with some VBA code -- specifically an "event procedure".

Rightclick the sheet tab and select "View Code" from the pop-up menu to
access the VBA module for the sheet. Then paste this into the module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Cells.Count <> 1 Then Exit Sub
If Target.Column = 1 Then
Target.Offset(0, 1) = Date
End If
End Sub

It assumes that the "info column" is A (Target.Column = 1) and the date
column is B (Target.Offset(0, 1), i.e. one to the right), so change those to
suit if necessary.

Alternatively, you could just use the kb shrtcut for insert current date
(CTRL+;).
 
S

Stefi

You can do that with this Change event sub?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then 'column of your client data, "A" in this
example
Cells(Target.Row, Target.Column + 1).Value = Date 'same row, next
column
End If
End Sub

Regards,
Stefi


„Nigel†ezt írta:
 
N

Nigel

Thanks Andy, will give it a go!

Andy Brown said:
You could do this with some VBA code -- specifically an "event procedure".

Rightclick the sheet tab and select "View Code" from the pop-up menu to
access the VBA module for the sheet. Then paste this into the module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Cells.Count <> 1 Then Exit Sub
If Target.Column = 1 Then
Target.Offset(0, 1) = Date
End If
End Sub

It assumes that the "info column" is A (Target.Column = 1) and the date
column is B (Target.Offset(0, 1), i.e. one to the right), so change those to
suit if necessary.

Alternatively, you could just use the kb shrtcut for insert current date
(CTRL+;).
 
N

Nigel

Worked a treat, thanks!

Andy Brown said:
You could do this with some VBA code -- specifically an "event procedure".

Rightclick the sheet tab and select "View Code" from the pop-up menu to
access the VBA module for the sheet. Then paste this into the module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Cells.Count <> 1 Then Exit Sub
If Target.Column = 1 Then
Target.Offset(0, 1) = Date
End If
End Sub

It assumes that the "info column" is A (Target.Column = 1) and the date
column is B (Target.Offset(0, 1), i.e. one to the right), so change those to
suit if necessary.

Alternatively, you could just use the kb shrtcut for insert current date
(CTRL+;).
 
Top