Todays date, dependant on multiple cell value

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,970
Office Version
  1. 2010
Platform
  1. Windows
It’s been a while since I’ve posted on here, but I need someone’s expertise & help<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
Basically I have a sheet populated A:K, I need to record today’s date (as a static date) in column D – so if cells, B or C are populated with text, the date will appear in column D<o:p></o:p>
<o:p> </o:p>
EG<o:p></o:p>
<o:p> </o:p>
B1 – Mark<o:p></o:p>
C1 – Andrews<o:p></o:p>
<o:p> </o:p>
Then, D1 = 20/03/09<o:p></o:p>
<o:p> </o:p>
I was thinking about using =today() in some sort of code, but that’s a volatile function & not sure it would work for me<o:p></o:p>
<o:p> </o:p>
Any help greatly appreciated<o:p></o:p>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Sounds like a Worksheet_Change event:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("B:C")) Is Nothing Or Target.Count > 1 Then Exit Sub
Me.Cells(Target.Row, "D") = Date
 
End Sub


(Right-click worksheet tab, View Code, paste it into that code window)

HTH!
 
Upvote 0
Although, your "static" date would be overwritten if B or C were subsequently edited.....

Maybe this is better?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("B:C")) Is Nothing Or Target.Count > 1 Or Me.Cells(Target.Row, "D") > 0 Then Exit Sub
Me.Cells(Target.Row, "D") = Date

End Sub
 
Upvote 0
Thanks Yard, will that overwrite the date each time its run tho? as i need to keep the dates which are already entered on the sheet
 
Upvote 0
Although, your "static" date would be overwritten if B or C were subsequently edited.....

Maybe this is better?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("B:C")) Is Nothing Or Target.Count > 1 Or Me.Cells(Target.Row, "D") > 0 Then Exit Sub
Me.Cells(Target.Row, "D") = Date
 
End Sub

Thanks Yard :)
 
Upvote 0

Forum statistics

Threads
1,203,534
Messages
6,055,956
Members
444,839
Latest member
laurajames

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