View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
horinemj horinemj is offline
external usenet poster
 
Posts: 5
Default input date as date in formula

ok... since you did such a great job helping me with that problem... to take it a step further...

when i delete the "C," the date in the adjacent column remains. how do i delete that date automatically if the "C" is deleted?

thanks!

jill.

"sebastienm" wrote:

Hi Jill,
The following event macro has to be placed in the corresponding sheet code module.
It assumes the C is entered in column rgSEntry (here, A:A. If not, change the Set RgSEntry line).
Anytime a cell is changed in column rgSEntry (A:A), it writes the current date to the cell on its right (here, B:B).

'-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rgSEntry As Range
Dim Rg As Range
Dim cell As Range

Set rgSEntry = Range("A:A") '<---- change here
'column where the C is placed

Application.EnableEvents = False
Set Rg = Application.Intersect(rgSEntry, Target)
If Not Rg Is Nothing Then
Rg.Offset(0, 1).Value = Date 'Write data one column on the right
End If
Application.EnableEvents = True
End Sub
'------------------------------------------------------------------
--
Regards,
Sébastien