View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Paul3rd Paul3rd is offline
external usenet poster
 
Posts: 28
Default Run Time Error '91'

Thanks Dave,
That worked perfectly.
Paul

"Dave Peterson" wrote:

And you can check for a comment in B4 in code with:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Me.Range("B4").Comment Is Nothing Then
'don't try to use .visible
Else
Me.Range("B4").Comment.Visible _
= Not (Intersect(Target, Range("B4")) Is Nothing)
End If
End Sub




Paul3rd wrote:

Hello,
The following code causes Run Time Error '91' when I insert it into
worksheets.
The code allows comments to be shown when cell is active.
Can anyone help?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("B4").Comment.Visible = Not (Intersect(Target, Range("B4")) Is
Nothing)
End Sub
Thanks in advance for any help,
Paul


--

Dave Peterson