Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default is it possible to set a cel to write the date and hour or date or

at the moment you enter the cell it will be formated to give the time of that
moment.
thanx for all the great answers.

bee
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default is it possible to set a cel to write the date and hour or date or

i need to add that , i need it to be formated in such a way that once u leave
the cell it will be locked and would not change if u return to it again at a
different time. Please write the syntax.
best regards

"kbee" wrote:

at the moment you enter the cell it will be formated to give the time of that
moment.
thanx for all the great answers.

bee

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default is it possible to set a cel to write the date and hour or date or

This could be done, but not with a worksheet formula. It would need to be
done using VBA code.

To accomplish the second part of your request, the worksheet would need to
be protected and the cells where you are entering the date would have to be
locked. Cells where you do want people to be able to type in/edit
information would need to be unlocked.

Without more specific information I can't do much more than show 'generic'
code on how to do this. This code would put the date/time into any empty
cell in column A that is clicked on and keep that from being changed, while
it would ignore changes in any other column.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const sheetPW = "jlatham" ' the assigned password for the sheet
If Application.Intersect(Target, Range("A:A")) Is Nothing Then
Exit Sub ' did not click cell in column A
End If
If Target.Cells.Count 1 Then
'chose more than 1 cell in column A
Exit Sub
End If
'does the cell have anything in it already?
If Not IsEmpty(Target) Then
'something there, do not change it
Exit Sub
End If
'unprotect the sheet so that
'we can put a time in the cell
ActiveSheet.Unprotect Password:=sheetPW
Target = Now() ' insert the date/time
'protect the sheet to keep from changing time entries
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=sheetPW
End Sub

"kbee" wrote:

at the moment you enter the cell it will be formated to give the time of that
moment.
thanx for all the great answers.

bee

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
entering date/time in 1/4 or 1/2 hour increments? David Excel Discussion (Misc queries) 5 August 28th 07 10:31 AM
Count by date and hour ChristiaanV Excel Worksheet Functions 4 August 12th 06 12:26 AM
Comparing specific date and hour with NOW() Memoman Excel Worksheet Functions 1 July 15th 06 10:14 PM
Convert Date/Time to the Hour eric_rs1 Excel Discussion (Misc queries) 2 October 3rd 05 04:40 PM
Subtracting date:hour from date:hour [email protected] Excel Worksheet Functions 4 August 26th 05 08:35 AM


All times are GMT +1. The time now is 10:39 AM.

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"