#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date column

I want a date column which shows the date of when data was entered in
that row. How is this done? Thanks.


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default date column

This uses column 3 (C) as the date column. Right click on the sheet tab and
select view code. Paste in code like this:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count 1 Then Exit Sub
If Target.Column < 3 Then
Application.EnableEvents = False
Cells(Target.Row, 3).Value = Now
Cells(Target.Row, 3).NumberFormat = "mm/dd/yy hh:mm"
Columns(3).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"jamie85 " wrote in message
...
I want a date column which shows the date of when data was entered in
that row. How is this done? Thanks.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date column

Great thanks i have edited the code to suit as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count 1 Then Exit Sub
If Target.Column < 11 Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub

What would i have to change so the code would only apply to cells K2
K30 ? Thank

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date column

Great thanks i have edited the code to suit as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count 1 Then Exit Sub
If Target.Column < 11 Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub

What would i have to change so the code would only apply to cells K2
K30 ? Thank

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default date column

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count 1 Then Exit Sub
If Not Intersect(Range("K2:K30"),Target) is nothing Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


jamie85 wrote in message
...
Great thanks i have edited the code to suit as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count 1 Then Exit Sub
If Target.Column < 11 Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub

What would i have to change so the code would only apply to cells K2 -
K30 ? Thanks


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Unique Values in 1 Column based on Date Range in another Column Brian Excel Worksheet Functions 14 May 17th 09 02:58 PM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Need the formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
Need Formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
If data in one column, take date, add 2 days, and turn the entire column a color... [email protected] Excel Discussion (Misc queries) 6 August 24th 06 03:58 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"