Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2017, 07:15 AM
Phil H Phil H is offline Auto populate cell with today's date Windows XP Auto populate cell with today's date Office 2010 64bit
Advanced Beginner
Auto populate cell with today's date
 
Join Date: Jun 2010
Posts: 81
Phil H is on a distinguished road
Default Auto populate cell with today's date

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.
Reply With Quote
  #2  
Old 10-06-2017, 08:12 AM
Debaser's Avatar
Debaser Debaser is offline Auto populate cell with today's date Windows 7 64bit Auto populate cell with today's date Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

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
Reply With Quote
  #3  
Old 10-12-2017, 07:51 AM
Phil H Phil H is offline Auto populate cell with today's date Windows XP Auto populate cell with today's date Office 2010 64bit
Advanced Beginner
Auto populate cell with today's date
 
Join Date: Jun 2010
Posts: 81
Phil H is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 10-12-2017, 07:57 AM
Debaser's Avatar
Debaser Debaser is offline Auto populate cell with today's date Windows 7 64bit Auto populate cell with today's date Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

I honestly don't see how that could happen with what I posted. Can you show me a workbook where it does?
Reply With Quote
  #5  
Old 10-12-2017, 08:48 AM
Phil H Phil H is offline Auto populate cell with today's date Windows XP Auto populate cell with today's date Office 2010 64bit
Advanced Beginner
Auto populate cell with today's date
 
Join Date: Jun 2010
Posts: 81
Phil H is on a distinguished road
Default

Do you have a private location?
Reply With Quote
  #6  
Old 10-16-2017, 04:07 AM
Debaser's Avatar
Debaser Debaser is offline Auto populate cell with today's date Windows 7 64bit Auto populate cell with today's date Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Can you not attach the file here? It doesn't need any data in it.
Reply With Quote
  #7  
Old 10-17-2017, 06:31 AM
Phil H Phil H is offline Auto populate cell with today's date Windows XP Auto populate cell with today's date Office 2010 64bit
Advanced Beginner
Auto populate cell with today's date
 
Join Date: Jun 2010
Posts: 81
Phil H is on a distinguished road
Default Simplified Test Worksheet

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
Attached Files
File Type: xlsx AutoDateUpdate.xlsx (8.2 KB, 12 views)
Reply With Quote
  #8  
Old 10-18-2017, 09:41 AM
Debaser's Avatar
Debaser Debaser is offline Auto populate cell with today's date Windows 7 64bit Auto populate cell with today's date Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Works absolutely fine here once the code is added.
Reply With Quote
Reply

Tags
autopopulate, today

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto populate cell with today's date Auto-enter today's date with New Order Macro button? barbd777 Excel Programming 6 04-08-2016 01:53 PM
Auto populate cell with today's date 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft