Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count Unique Values in 1 Column based on Date Range in another Column | Excel Worksheet Functions | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
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 | Excel Discussion (Misc queries) | |||
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 | Excel Discussion (Misc queries) | |||
If data in one column, take date, add 2 days, and turn the entire column a color... | Excel Discussion (Misc queries) |