Auto Add Date in Multiple Columns

ddufour

New Member
Joined
Jun 18, 2012
Messages
2
Hey,

I'm trying to Auto Update a column once a preceding column is updated. For example, when I update D5, E5 will add the date. Likewise, when I update J5, K5 will add a date. It is important that the date inserted does not update with the current time of the spreadsheet, [ ie. now()]

Currently I can get one column to work with the following macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Target.Parent.Range("F:F")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Value = "" Then Target.Offset(0, 1).Value = ""
If Target.Value <> "" Then Target.Offset(0, 1).Value = Now
End Sub

But I need this applied to columns A, C, F, L etc. Any help would be greatly appreciated.

Cheers,
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

drsarao

Well-known Member
Joined
Sep 9, 2009
Messages
1,143
Office Version
  1. 2007
Platform
  1. Windows
Try this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
c = Target.Column
If c = 1 Or c = 3 Or c = 6 Or c = 12 Then 'cols A, C, F, L
    If Target.Value = "" Then Target.Offset(0, 1).Value = ""
    If Target.Value <> "" Then Target.Offset(0, 1).Value = Now
End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,950
Messages
5,599,028
Members
414,275
Latest member
Pungie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top