Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Create a date that will not change

If a cell returns a certain value, can a date be made to appear in an
adjacent cell that will not change even if the first cell's value does
change with time. For example, if cell A1=1, then B1 shows the date
A1=1, even though A1 will eventually excede the value of 1 (therefore
A1=1). I need a date macro that will show only the first date A1=0.
Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,090
Default Create a date that will not change

To do what you want requires a Worksheet_Change event macro. The following
macro will put the date in B1 whenever A1 changes to anything =0. However,
if B1 is already occupied, nothing will change in B1 no matter what happens
in A1.
Note that this macro must be placed in the sheet module of your sheet. To
access that module, right-click on the sheet tab, select View code, paste
this macro into that module. "X" out of the module to return to your sheet.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
If IsEmpty(Target.Offset(, 1).Value) Then _
If Target.Value = 0 Then Target.Offset(, 1).Value = Date
End If
End Sub

wrote in message
ups.com...
If a cell returns a certain value, can a date be made to appear in an
adjacent cell that will not change even if the first cell's value does
change with time. For example, if cell A1=1, then B1 shows the date
A1=1, even though A1 will eventually excede the value of 1 (therefore
A1=1). I need a date macro that will show only the first date A1=0.
Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Create a date that will not change

Thank you so very much. This is great.

Michael


Otto Moehrbach wrote:
To do what you want requires a Worksheet_Change event macro. The following
macro will put the date in B1 whenever A1 changes to anything =0. However,
if B1 is already occupied, nothing will change in B1 no matter what happens
in A1.
Note that this macro must be placed in the sheet module of your sheet. To
access that module, right-click on the sheet tab, select View code, paste
this macro into that module. "X" out of the module to return to your sheet.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
If IsEmpty(Target.Offset(, 1).Value) Then _
If Target.Value = 0 Then Target.Offset(, 1).Value = Date
End If
End Sub

wrote in message
ups.com...
If a cell returns a certain value, can a date be made to appear in an
adjacent cell that will not change even if the first cell's value does
change with time. For example, if cell A1=1, then B1 shows the date
A1=1, even though A1 will eventually excede the value of 1 (therefore
A1=1). I need a date macro that will show only the first date A1=0.
Thanks.


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
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
How do I have the date in a spreadsheet change automically. VC Excel Discussion (Misc queries) 1 September 29th 06 09:05 AM
How do I have the date in a spreadsheet change automically. VC Excel Discussion (Misc queries) 1 September 29th 06 02:37 AM
Can I change a date with no format (20051111) to date format? Rose New Users to Excel 2 November 11th 05 09:03 PM
date auto change Colin2u Excel Discussion (Misc queries) 3 August 21st 05 05:26 AM


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