auto fill in date

lewashby85

New Member
Joined
Aug 1, 2017
Messages
2
I'm using the following VBA script in my excel file at work to auto fill in today's date in the column to the right when I enter data into the column to the left. It's working but the only thing I don't like is it is also inserting today's date into the column on the right even when I delete data from the column on the left. I only want it to insert data into the left hand column when data is added/inserted into the left hand column, not when removing data from the left hand column.


Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If (Target.Count = 1) And _
       (Not Intersect(Target, [H:H]) Is Nothing) Then _
        Target.Offset(0, 1) = Date
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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