Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Entering static Date/Time
I'm trying to enter a date and a time in a worksheet if there is dat entered into a particular cell. Example - Cell A contains data or nul - if data, enter current date in Cell B and current time in cell C. Problem I keep running into, the date/time updates to current with dat entry into the next row. Anyone have any ideas -- GAMOSTEV ----------------------------------------------------------------------- GAMOSTEVE's Profile: http://www.excelforum.com/member.php...fo&userid=1476 View this thread: http://www.excelforum.com/showthread.php?threadid=26384 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Entering static Date/Time
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count 1 Then Exit Sub If Target.Column < 1 Then Exit Sub For Each cell In Target If Not IsEmpty(cell) Then Cells(Target.Row, "B").Value = Date Cells(Target.Row, "C").Value = Time Columns("B:C").AutoFit End If Next End Sub right click on the sheet tab and select view code. Paste in code like the above. -- Regards, Tom Ogilvy "GAMOSTEVE" wrote in message ... I'm trying to enter a date and a time in a worksheet if there is data entered into a particular cell. Example - Cell A contains data or null - if data, enter current date in Cell B and current time in cell C. Problem I keep running into, the date/time updates to current with data entry into the next row. Anyone have any ideas? -- GAMOSTEVE ------------------------------------------------------------------------ GAMOSTEVE's Profile: http://www.excelforum.com/member.php...o&userid=14762 View this thread: http://www.excelforum.com/showthread...hreadid=263848 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Entering static Date/Time
Had some formatting problems:
Private Sub Worksheet_Change(ByVal Target As Range) Dim cell as Range If Target.Columns.Count 1 Then _ Exit Sub If Target.Column < 1 Then _ Exit Sub For Each cell In Target If Not IsEmpty(cell) Then Cells(Target.Row, "B").Value = Date Cells(Target.Row, "C").Value = Time Columns("B:C").AutoFit End If Next End Sub -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Columns.Count 1 Then Exit Sub If Target.Column < 1 Then Exit Sub For Each cell In Target If Not IsEmpty(cell) Then Cells(Target.Row, "B").Value = Date Cells(Target.Row, "C").Value = Time Columns("B:C").AutoFit End If Next End Sub right click on the sheet tab and select view code. Paste in code like the above. -- Regards, Tom Ogilvy "GAMOSTEVE" wrote in message ... I'm trying to enter a date and a time in a worksheet if there is data entered into a particular cell. Example - Cell A contains data or null - if data, enter current date in Cell B and current time in cell C. Problem I keep running into, the date/time updates to current with data entry into the next row. Anyone have any ideas? -- GAMOSTEVE ------------------------------------------------------------------------ GAMOSTEVE's Profile: http://www.excelforum.com/member.php...o&userid=14762 View this thread: http://www.excelforum.com/showthread...hreadid=263848 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Static Date and Time and VBA editing | New Users to Excel | |||
embedded static time & date | Excel Worksheet Functions | |||
static date and time | Excel Discussion (Misc queries) | |||
Static Date and Time code problem | Excel Discussion (Misc queries) | |||
how can i set a static date and time in excel | Excel Worksheet Functions |