ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Value auto filled in (https://www.excelbanter.com/excel-programming/340646-date-value-auto-filled.html)

GregR

Date Value auto filled in
 
I have a huge spreadhseet and I need a worksheet change event to
populate a target cell in column(AB) with today's date value, if
anything gets added to target cells in columns(O:X). In other words, if
O22 has something filled in AB22 would have today's date value. If at a
later date S22 gets something filled in AB22 would update to the
current date. TIA

Greg


Bob Phillips[_6_]

Date Value auto filled in
 
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("O:X")) Is Nothing Then
With Target
Cells(Target.Row, "AB") = Format(Date, "dd mmm yyyy")
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

"GregR" wrote in message
ups.com...
I have a huge spreadhseet and I need a worksheet change event to
populate a target cell in column(AB) with today's date value, if
anything gets added to target cells in columns(O:X). In other words, if
O22 has something filled in AB22 would have today's date value. If at a
later date S22 gets something filled in AB22 would update to the
current date. TIA

Greg




GregR

Date Value auto filled in
 
Bob, thanks for your prompt and accurate reply.

Greg



All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com