Enter the fixed date when data is entered into a column for multiple columns

t_faragher13

New Member
Joined
Apr 5, 2011
Messages
12
I've got an excel sheet with a number of user filled columns. I would like the date that an entry is added to each column to be entered into the next column for each one.

I've found this script

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range, cell As Range
Dim Msg As String
Dim ValidateCode As Variant
Set VRange = Range("I:I")
For Each cell In Target
If Union(cell, VRange).Address = VRange.Address Then
cell.Offset(, -1) = Date
End If
Next cell
End Sub

Which does what I want, but just for the one column I:I. I cant work out how to make it work for multiple columns in the same worksheet.

Can anyone help me with this?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
When a cell in column D is created, I'd like the date to be added to column A, and when a cell in column H is added I'd like the date to be added in to column G.
Is it also possible to make it so that once a date has been created in the column it wont change when the cells are edited later on?

Would really appreciate your help on this.

Tom
 
Upvote 0
Maybe:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range, cell As Range
    If Target.Cells.Count > 1 Then Exit Sub
    If Target.Column <> 4 And Target.Column <> 8 Then Exit Sub
    If Target.Column = 4 Then
        colOffset = 3
    Else
        colOffset = 1
    End If
    If IsEmpty(Target.Offset(0, -colOffset)) Then
        Application.EnableEvents = False
        Target.Offset(0, -colOffset).Value = Date
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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