![]() |
|
#1
|
|||
|
|||
|
Need a macro to auto-populate a cell with todays date: Range is B3:AS38. If any cell data are changed in a row, put today’s date in cell AT (that row). For example, if cell AN25 is changed, put today’s date in cell AT25. |
|
#2
|
||||
|
||||
|
Right click the worksheet tab and choose View Code, then paste this in:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
On Error GoTo oops
If Not Intersect(Target, Range("B3:AS38")) Is Nothing Then
Application.EnableEvents = False
For Each cell In Intersect(Target, Range("B3:AS38")).Cells
Cells(cell.Row, "AT").Value = Date
Next cell
End If
oops:
Application.EnableEvents = True
End Sub
|
|
#3
|
|||
|
|||
|
Debaser, Did as you suggested, but it doesn't work - locks up the application and fades the screen.
To clarify further - any entry on a row in the range will result in today's date being placed in cell AT for that row. |
|
#4
|
||||
|
||||
|
I honestly don't see how that could happen with what I posted. Can you show me a workbook where it does?
|
|
#5
|
|||
|
|||
|
Do you have a private location?
|
|
#6
|
||||
|
||||
|
Can you not attach the file here? It doesn't need any data in it.
|
|
#7
|
|||
|
|||
|
Debaser, Created a simple test worksheet with the below code - still does not work.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
On Error GoTo oops
If Not Intersect(Target, Range("B3:E5")) Is Nothing Then
Application.EnableEvents = False
For Each cell In Intersect(Target, Range("B3:E5")).Cells
Cells(cell.Row, "F").Value = Date
Next cell
End If
oops:
Application.EnableEvents = True
End Sub
|
|
#8
|
||||
|
||||
|
Works absolutely fine here once the code is added.
|
|
| Tags |
| autopopulate, today |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Auto-enter today's date with New Order Macro button?
|
barbd777 | Excel Programming | 6 | 04-08-2016 01:53 PM |
auto cell populate
|
Stevejd58 | Excel | 14 | 05-13-2013 02:22 AM |
| Creating an Auto-Calc'd Date? Today+7 Days? | SoCalTelephone | Word | 0 | 10-06-2010 10:27 AM |
| How can I make a cell color RED under the Today's date cell? | Learner7 | Excel | 2 | 07-08-2010 12:52 AM |
| Auto-populate an MS Word table cell with text from a diff cell? | dreamrthts | Word Tables | 0 | 03-20-2009 01:49 PM |