View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Date Less[_2_] Date Less[_2_] is offline
external usenet poster
 
Posts: 4
Default use CTRL key inside a formula

Thank you Gord that works really well I was able to take that advice and
change it to the A column and post the date in the B column and also the time
in the C column with the code.

Date less

"Gord Dibben" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A2")) Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
Select Case Target.Value
Case "Yes"
Target.Offset(0, 1).Value = Format(Date, "dd/mm/yyyy")
Case "No"
Target.Offset(0, 1).Value = ""
End Select
endit:
Application.EnableEvents = True
End Sub

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

Copy/paste the code into that sheet module.

Alt + q to go back to the Excel window.

Select Yes ot No from dropdown in A2


Gord

On Mon, 14 Apr 2008 18:01:01 -0700, Date Less
wrote:



"Gord Dibben" wrote:

Not inside a formula.

What do you want in B2?

If today A2 equals "Yes" you want the date in B2?

If tomorrow A2 < "Yes" what do you want to see in B2.........nothing?

If next Thursday A2 goes back to "Yes" should value of B2 change to that date?

I think you will have to resort to event code.


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 16:03:00 -0700, Date Less
wrote:

use CTRL key + ; inside a formula to put the static date in B2 If a2 = YES

if(a2="yes",today(),"blank") the date changes I want to replace today() with
CTRL ;


The formula will be in b2. I have a drop down box in a2 'yes and no' if the user chooses yes then I want the static date in b2 if the user chooses no the I will leave b2 blank. I did use Today() last week on Friday the 11th and today when I opened the XLS document the date changed to the 14th. The research I have found so far is that <CTRL + ; puts in a static date.