#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 709
Default display a date

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default display a date

Hi,

Right click your sheet tab, view code and paste the code below in. It
currently works on data entered in column A so change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
Application.EnableEvents = True
End If
End Sub

Mike

"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default display a date

Hi Richard

If you are new to macros set the Security level to low/medium in
(Tools|Macro|Security) before trying out Mike's code.

If this post helps click Yes
---------------
Jacob Skaria


"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste the code below in. It
currently works on data entered in column A so change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
Application.EnableEvents = True
End If
End Sub

Mike

"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default display a date

Hi,

Since you are only interested to get the date when you enter a number try this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Or Not IsNumeric(Target)
Then Exit Sub
If Not Intersect(Target, [A:A]) Is Nothing Then
Target.Offset(, 1) = Date
End If
End Sub

If you are only doing this for a single column, here column A:A, then you
don't need to disable events... However if you want this to work for the
entire worksheet then you need to include them.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 709
Default display a date


that works but the date changes every day i need it to stay the date the
number was entered

thanks

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste the code below in. It
currently works on data entered in column A so change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
Application.EnableEvents = True
End If
End Sub

Mike

"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 709
Default display a date

that works but the date changes every day, i need it to stay the date the
number was entered

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste the code below in. It
currently works on data entered in column A so change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
Application.EnableEvents = True
End If
End Sub

Mike

"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 709
Default display a date

how do i include events?
i have about 20 columns that i want this to work with. i need the date to
come up in the cell to the left of the cell that i put the number in

thanks

"Shane Devenshire" wrote:

Hi,

Since you are only interested to get the date when you enter a number try this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Or Not IsNumeric(Target)
Then Exit Sub
If Not Intersect(Target, [A:A]) Is Nothing Then
Target.Offset(, 1) = Date
End If
End Sub

If you are only doing this for a single column, here column A:A, then you
don't need to disable events... However if you want this to work for the
entire worksheet then you need to include them.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default display a date

Hi Richard

Try the below...modified to suit your requirement

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
IF Target.Offset(, 1) = "" Then
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
End If
Application.EnableEvents = True
End If
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Richard" wrote:

that works but the date changes every day, i need it to stay the date the
number was entered

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste the code below in. It
currently works on data entered in column A so change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
Target.Offset(, 1) = Format(Now, "dd/mmm/yyyy")
Application.EnableEvents = True
End If
End Sub

Mike

"Richard" wrote:

Hi
when i enter a number into a cell i want the cell next to it to display the
date the number was entered

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
If weekend date display previous Friday date jimar Excel Discussion (Misc queries) 4 September 17th 08 03:01 PM
Dates - Need to display date one month prior to user-entered date brettopp Excel Worksheet Functions 13 December 3rd 07 05:58 PM
How to display date? Eric Excel Discussion (Misc queries) 3 September 17th 07 12:28 PM
Formula to Display Date n-Workdays from a Certain Date BHadds Excel Discussion (Misc queries) 4 June 13th 07 09:49 PM
X axis date - display beyond latest date. Dave F. Charts and Charting in Excel 1 January 3rd 07 03:17 AM


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