Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Static Date and Time and VBA editing MilleniumPro New Users to Excel 2 July 24th 09 05:25 AM
embedded static time & date james Excel Worksheet Functions 3 May 17th 09 05:40 PM
static date and time Wanna Learn Excel Discussion (Misc queries) 2 January 29th 09 05:05 PM
Static Date and Time code problem Laura Excel Discussion (Misc queries) 12 August 31st 07 07:04 AM
how can i set a static date and time in excel ucastores Excel Worksheet Functions 2 June 3rd 06 01:38 AM


All times are GMT +1. The time now is 04:18 PM.

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"