Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default Auto Insert the present time when a cell is filled with a data,

"Insert Time when a cell is filled with data, but don't update the time
how to use the following code and where to put this code can someone please
explain a step by step guide for this please?
Once the time is inserted, you could edit/copy/paste special/values.
You might also try setting up a macro that would do the now function and
then paste values.

The following code will auto insert the time using ctrl+y


Sub Time_Constant()
'
' Time_Constant Macro
'
' Keyboard Shortcut: Ctrl+y
'
ActiveCell.FormulaR1C1 = "=NOW()"
Range("A1").Select
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub"

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1,805
Default Auto Insert the present time when a cell is filled with a data,

Open Excel
Press ALT-F11 to open VB Editor
Choose Insert-Module
Paste the code
Switch to Excel
Choose Tools-Macros
Select the Time_Constant macro
Click on Options
Choose the shortt-cut key you want...

Use that key to insert current date/time with format in the current cell
"[$-409]h:mm AM/PM;@"

"Dinanath" wrote:

"Insert Time when a cell is filled with data, but don't update the time
how to use the following code and where to put this code can someone please
explain a step by step guide for this please?
Once the time is inserted, you could edit/copy/paste special/values.
You might also try setting up a macro that would do the now function and
then paste values.

The following code will auto insert the time using ctrl+y


Sub Time_Constant()
'
' Time_Constant Macro
'
' Keyboard Shortcut: Ctrl+y
'
ActiveCell.FormulaR1C1 = "=NOW()"
Range("A1").Select
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub"

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Auto Insert the present time when a cell is filled with a data,

If you are going to use shortcut key to insert a staic time you may as well
go with the built-in shortcut.

CTRL + SHIFT + ;(semi-colon)

I would use a change event to insert the static time when the dat is entered
and not bother with any shortcut key macro.

This code added to the sheet module will give you a time in column A when
data is entered in column B

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("B:B")) Is Nothing Then
Target.Offset(0, -1).Value = Now()
End If
End Sub

Right-click on the sheet tab and "View Code". Copy/paste into that module.

Edit to suit..............if you need help with that, post back with details
on range(s) to use.


Gord Dibben MS Excel MVP

On Sun, 8 Mar 2009 12:55:01 -0700, Dinanath
wrote:

"Insert Time when a cell is filled with data, but don't update the time
how to use the following code and where to put this code can someone please
explain a step by step guide for this please?
Once the time is inserted, you could edit/copy/paste special/values.
You might also try setting up a macro that would do the now function and
then paste values.

The following code will auto insert the time using ctrl+y


Sub Time_Constant()
'
' Time_Constant Macro
'
' Keyboard Shortcut: Ctrl+y
'
ActiveCell.FormulaR1C1 = "=NOW()"
Range("A1").Select
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub"


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
Auto insert Date & Time when another cell is populated Trixie Excel Discussion (Misc queries) 1 October 2nd 06 03:59 AM
Auto insert new row after current row filled in Capsaisin Excel Discussion (Misc queries) 1 May 18th 06 11:46 PM
insert zeros in front of cells already filled with data. Horizon Excel Discussion (Misc queries) 2 January 16th 06 08:47 PM
How do I auto fill long col. filling blanks with last filled cell MBBeginner Excel Discussion (Misc queries) 3 January 15th 06 12:44 AM
Auto date/time insert when data entered into an adjacent cell Auto date/time Excel Worksheet Functions 1 July 9th 05 12:10 AM


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