Setting a date field trigger by another cell

Angus McBagpipe

New Member
Joined
Mar 1, 2007
Messages
36
I have a field G9 that I set by picking from a predetermined validation list.
When I set that status in G9 I'd like the date in E9 to be set to todays date. This is my interaction date.

How do I go about using VB to accomplish this?
I have used VB in the past but not very much. New job new challenges.

Any help would be greatly appreciated.

Angus,
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I don't think you have to use VBA for this solution unless you want to. I guess if E9 needs to be a static date instead of:
Code:
=IF(G9="","",TODAY())

VBA would be like this:
Code:
If Range("G9").Value <> "" Then
    Range("E9").Value = Date
End If
 
Upvote 0
So, a worksheet event on change. If the address of the cell that was changed is G9, then put today's date in E9:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "G9" Then
        Range("E9").Value = Date
    End If
End Sub
 
Upvote 0
AFPathfinder, there is a minor issue with this line of code:
Code:
    If Target.Address = "G9" Then
That will not work as written.

It needs to be either:
Code:
    If Target.Address = "$G$9" Then
or
Code:
    If Target.Address(0,0) = "G9" Then
 
Last edited:
Upvote 0
Ah, thanks for the correction, Joe4! Updated solution:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$G$9" Then
        Range("E9").Value = Date
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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