Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Excel > Excel Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-06-2017, 07:15 AM
Phil H Phil H is offline Windows XP Office 2010 64bit
Advanced Beginner
 
Join Date: Jun 2010
Posts: 57
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 Debaser is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 132
Debaser is on a distinguished road
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 Windows XP Office 2010 64bit
Advanced Beginner
 
Join Date: Jun 2010
Posts: 57
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 Debaser is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 132
Debaser is on a distinguished road
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 Windows XP Office 2010 64bit
Advanced Beginner
 
Join Date: Jun 2010
Posts: 57
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 Debaser is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 132
Debaser is on a distinguished road
Default

Can you not attach the file here? It doesn't need any data in it.
Reply With Quote
  #7  
Old Yesterday, 06:31 AM
Phil H Phil H is offline Windows XP Office 2010 64bit
Advanced Beginner
 
Join Date: Jun 2010
Posts: 57
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, 4 views)
Reply With Quote
  #8  
Old Today, 09:41 AM
Debaser Debaser is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 132
Debaser is on a distinguished road
Default

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

Tags
autopopulate, today
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


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


All times are GMT -7. The time now is 06:52 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft