View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jock Jock is offline
external usenet poster
 
Posts: 440
Default Dates and comments

Last one for the day!
I'm keen to get this one to work so that when a date is entered in 'D', a
comment box appears in 'F' with 'D's date plus 14 in it.
This would save a lot of grief!
However, I can't get any comment box to appear with you code. I have copied
it into a Worksheet_Change event that is already so I'll copy the whole thing
below to see if you can help me out on this one.
Thanks Mike.

Private Sub Worksheet_Change(ByVal Target As Range)

'Enters todays date in A when case number entered in B
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B5:B100")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Date, "dd/mmm")
End If
End With
End If
'Application.EnableEvents = True


'Application.EnableEvents = False
If Not IsDate(Target) Or Target.Cells.Count 1 Then Exit Sub
If Not Intersect(Target, Range("I:I")) Is Nothing Then
DateFormat = "dd-mmm"
Newdate = DateAdd("I", 14, Target.Value)
Target.Offset(, 1).AddComment.Text Text:=Format(Newdate, DateFormat)
Application.EnableEvents = True
End If
End Sub


--
Traa Dy Liooar

Jock


"Mike H" wrote:

Hi,

The only way I can make this error is with text in column D, did you put it
in as worksheet code and copy it exactly?

Mike

"Jock" wrote:

I get the message "Invalid procedure call or argument" with this one,
referring to the line beginning 'Range("F2")=......
??
Traa Dy Liooar

Jock


"Mike H" wrote:

Hi,

And for option 2 try this. Once again consider some error trapping by
checking if there's a date in column D for example

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("F:F")) Is Nothing Then
Range("F2") = DateAdd("D", 14, Target.Offset(, -2).Value)
End If
End Sub

Mike

"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