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,
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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
Back
Top