#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Date function

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Date function

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A20")) Is Nothing Then
If Target.Count = 1 Then _
Range("C" & Target.Row) = Format(Now, "mmm dd, yyyy h:mm AMPM;@")
End If
Application.EnableEvents = True
End Sub

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


"BC" wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Date function

Jacob,
I tried this, closed, then reopened. File became read-only. Once I opened,
the date changed again.
Here's the formula I'm using.

=if(m198=0,now())
--
BGC


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A20")) Is Nothing Then
If Target.Count = 1 Then _
Range("C" & Target.Row) = Format(Now, "mmm dd, yyyy h:mm AMPM;@")
End If
Application.EnableEvents = True
End Sub

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


"BC" wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Date function

To record the timestamp you cannot use a formula..You will have to use a VBA
solution as mentioned in my earlier post.

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


"BC" wrote:

Jacob,
I tried this, closed, then reopened. File became read-only. Once I opened,
the date changed again.
Here's the formula I'm using.

=if(m198=0,now())
--
BGC


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A20")) Is Nothing Then
If Target.Count = 1 Then _
Range("C" & Target.Row) = Format(Now, "mmm dd, yyyy h:mm AMPM;@")
End If
Application.EnableEvents = True
End Sub

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


"BC" wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Date function

OK,
How about just the date?
--
BGC


"Jacob Skaria" wrote:

To record the timestamp you cannot use a formula..You will have to use a VBA
solution as mentioned in my earlier post.

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


"BC" wrote:

Jacob,
I tried this, closed, then reopened. File became read-only. Once I opened,
the date changed again.
Here's the formula I'm using.

=if(m198=0,now())
--
BGC


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A20")) Is Nothing Then
If Target.Count = 1 Then _
Range("C" & Target.Row) = Format(Now, "mmm dd, yyyy h:mm AMPM;@")
End If
Application.EnableEvents = True
End Sub

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


"BC" wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Date function

There is no difference between just the date and the date/time... you cannot
"freeze" either one of them using just a formula... it cannot be done
without using VB coding.

--
Rick (MVP - Excel)


"BC" wrote in message
...
OK,
How about just the date?
--
BGC


"Jacob Skaria" wrote:

To record the timestamp you cannot use a formula..You will have to use a
VBA
solution as mentioned in my earlier post.

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


"BC" wrote:

Jacob,
I tried this, closed, then reopened. File became read-only. Once I
opened,
the date changed again.
Here's the formula I'm using.

=if(m198=0,now())
--
BGC


"Jacob Skaria" wrote:

Select the sheet tab which you want to work with. Right click the
sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code
to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A20")) Is Nothing Then
If Target.Count = 1 Then _
Range("C" & Target.Row) = Format(Now, "mmm dd, yyyy h:mm AMPM;@")
End If
Application.EnableEvents = True
End Sub

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


"BC" wrote:

Hi all,
I want cell b1 to display the current date and time based on cell
a1's
entry. I want the date to remain constant and not update unless a1
has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Date function

A bit of programming would work. Put this code in the sheet module
behind the workbook:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Range("B1").Calculate
End If
End Sub

--JP

On Sep 24, 1:56*pm, BC wrote:
Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. *I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Date function

JP,
It didn't work. Closed and reopen and the time updated!
--
BGC


"JP" wrote:

A bit of programming would work. Put this code in the sheet module
behind the workbook:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Range("B1").Calculate
End If
End Sub

--JP

On Sep 24, 1:56 pm, BC wrote:
Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!

--
BGC



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Date function

Ugh, you could have mentioned earlier that it needed to stay the same
even if the workbook closed. In that case, you'll probably need to
write more event handlers.

--JP


On Sep 24, 2:46*pm, BC wrote:
JP,
It didn't work. *Closed and reopen and the time updated!
--
BGC



"JP" wrote:
A bit of programming would work. Put this code in the sheet module
behind the workbook:


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
* Range("B1").Calculate
End If
End Sub


--JP


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Date function

To enter a static date/time you can do this manually.

While holding CTRL key hit semi-colon then spacebar then SHIFT + semi-colon.

To do this via VBA code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value < "" Then
Excel.Range("B" & n).Value = Format(Now, "mm-dd-yyyy hh:mm:ss")
End If
End If
enditall:
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste to that module.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP

On Thu, 24 Sep 2009 10:56:01 -0700, BC wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!




  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Date function

Gord,
This didn't work either. I held the time, but once I closed and reopened,
the time updated!
--
BGC


"Gord Dibben" wrote:

To enter a static date/time you can do this manually.

While holding CTRL key hit semi-colon then spacebar then SHIFT + semi-colon.

To do this via VBA code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value < "" Then
Excel.Range("B" & n).Value = Format(Now, "mm-dd-yyyy hh:mm:ss")
End If
End If
enditall:
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste to that module.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP

On Thu, 24 Sep 2009 10:56:01 -0700, BC wrote:

Hi all,
I want cell b1 to display the current date and time based on cell a1's
entry. I want the date to remain constant and not update unless a1 has been
changed.

I tried this and the date and time changes to current:

=if(a1=0,now())

Help!



  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Date function

Do not use a formula in B1.

Let the code enter the date/time for you.

Read ALL my instructions on where to place the code.


Gord

On Thu, 24 Sep 2009 11:49:02 -0700, BC wrote:

Gord,
This didn't work either. I held the time, but once I closed and reopened,
the time 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
Difference betwen Excel Date () Function and System Date Khalil[_2_] Excel Worksheet Functions 2 June 16th 09 01:10 PM
Difference System date and Excel Date function Khalil Excel Worksheet Functions 2 June 16th 09 11:23 AM
Date function in ACCRINTM requires date format not available Pev Excel Worksheet Functions 4 October 13th 07 12:20 PM
Date Function formula that will return the date of a specific week Greg Excel Worksheet Functions 4 June 12th 06 05:07 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Excel Worksheet Functions 2 February 10th 05 07:18 PM


All times are GMT +1. The time now is 06:05 AM.

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"