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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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