View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default Dates and comments

Unfortunately I do not have hard code to give you, but if you look into
events that can occur on a worksheet, then what you would want to do is
capture a cell change event.

If the change occurs in a cell that is in column D, then check to see if it
is a date or contains a date (Depending on what data you expect in the cell.
I.e., if you expect someone to type "This will be performed on 01/01/10" then
all you want from the text is the date.

If that is true, then assign the appropriate "object" (You mentioned a
comment, though not sure if you are referring to a little popup comment, or
just a string of text like "This is due on 01/15/10") the date of column D
incremented by 14 days. I don't recall the function name, but there is a
date option where you input the month, day, and year separately and it
provides a date code. I recommend this feature rather than just incrementing
the calendar day and displaying that as text, because if the date in Col D is
the 15th or later and it happens to be in February of a non-leap year then
the result would be the 29th of February or later which wouldn't exist in
that year. By using the format Year("year of col d") Month("Month of col D")
and day("Day of Col D" + 14), Excel will fix the month and year to correspond
to this new date.

Otherwise if you have a date data type, you simply add 14 to it and store it
in the data object necessary for Column F of the same row.

Don't know if that helps, there are others that can provide you the straight
code, I tend to try to provide the thought process to construct the code,
because there are a number of ways to get to the same result.

"Jock" wrote:

When a date is placed in any cell D, I would like either:
1) a comment to automatically be accociated to cell F on the same row with a
date displayed which will be the date from D + 14, OR
2) When the cell in F has focus, the date (D + 14) appears in a pre
determined cell at the top of the page, F2 for instance.

Any ideas?
--
Traa Dy Liooar

Jock