Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default enter a static time dependent upon another cell value

I want to automatically enter a static time in a cell when a value is entered
into another adjacent cell. The Now() function is dynamic and will change if
another field in the sheet is updated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default enter a static time dependent upon another cell value


Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<=== change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Time
.Offset(0, 1).NumberFormat = "hh:mm:ss"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kefee85" wrote in message
...
I want to automatically enter a static time in a cell when a value is

entered
into another adjacent cell. The Now() function is dynamic and will change

if
another field in the sheet is updated.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 751
Default enter a static time dependent upon another cell value

The following Event macro will fire whenever you change a cell in the
sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.cells(1,1).column = 14 and target.cells.count = 1 Then
Target.Offset(0, 1).Value = Now
endif
End Sub

Offset(0,1) refers to one cell to the right of the cell changed. The
check for
Target.cells(1,1).column = 14
for the moment will do so if the column in question is the 14th one
(N:N). Change the number to whatever column you want.

To install:
Right click the sheet tab. Select View Code... Paste the above code.

HTH
Kostis Vezerides


kefee85 wrote:
I want to automatically enter a static time in a cell when a value is entered
into another adjacent cell. The Now() function is dynamic and will change if
another field in the sheet is updated.


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
How do I enter a cell value into the Timevalue() function? busterpace Excel Worksheet Functions 1 October 8th 06 02:23 AM
time sheet drop down lists Steve Excel Discussion (Misc queries) 12 March 18th 06 10:30 PM
multiplycation of money cell and time cell engr625 Excel Worksheet Functions 1 August 3rd 05 04:53 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 07:29 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"