Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 104
Default time auto entry

This is working great! Thank you for your help.
--
Cathy


"Gord Dibben" wrote:

Wrong type of code for what you want.

The For Each will update every cell whenever a calculation takes place.

Try this sheet_change version.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Not Application.Intersect(Range("a2:a100"), Target) Is Nothing Then
n = Target.Row
If Me.Range("A" & n).Value < "" Then
Me.Range("B" & n).Value = Format(Date, "dd mm yyyy")
Me.Range("C" & n).Value = Format(Time, "hh:mm:ss")
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Fri, 16 Jan 2009 13:42:05 -0800, Cathy
wrote:

I'm doing something similar and can't quite get it to work. I used your code
and modified for my spreadsheet. I want col B (date) and col C (time) to
auto entry when someone manually enters an item in column A from a list
(name). But, it's still updating with the current date/time instead of
staying static. Any suggestions? Do I not have the code quite right? Thanks

Private Sub Worksheet_Calculate()
Set r = Range("a2:a100")
For Each a In r
If a.Value < "" And a.Offset(0, -10).Value = "" Then
Application.EnableEvents = False
Cells(a.Row, "b").Value = Date
Cells(a.Row, "c").Value = Time
Application.EnableEvents = True
End If
Next
End Sub



 
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
Auto tag the time in B1 to an entry in cell A! DDavid Excel Discussion (Misc queries) 4 November 5th 08 10:33 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
How do I set up entry box to auto-alphabatize each entry in list? jhakers Excel Discussion (Misc queries) 0 February 14th 08 08:01 PM
Inconsistent 'auto-entry' Terry Pinnell Excel Discussion (Misc queries) 2 October 31st 05 04:16 PM
Time Format Auto Entry AM and PM BulaMan Excel Discussion (Misc queries) 1 December 15th 04 09:30 AM


All times are GMT +1. The time now is 08:15 PM.

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

About Us

"It's about Microsoft Excel"