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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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