Thread: HELP! PLS!
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default HELP! PLS!

OK, I've been going over the code after your response (thank you!) and what I
don't understand is the order in which the code is being executed.

It looks as though the last line of code says to display the comment, but
the code above it says to hide the comment when leaving the cell.

Also, does r mean range? I've been researching and can't seem to find
something that clearly explains this... BTW, I sure see your name out there!

Thank you so much!

--
Thanks!

Dee


"Gary''s Student" wrote:

You are right on track !! The intersect thing just compares the currently
selected cell with the collection of cells that have comments. If the
currently selected cell is not part of the collection, then the currently
selected cell has no comments in it and the routine can exit.
--
Gary''s Student - gsnu200720


"dee" wrote:

Got it. I've been spending a lot of time trying to figure this code out and
think I have part of it. If you have time, would you mind looking at my
comments to tell me if I'm totally off track? There are xxx s where I don't
have a clue! Thank you.

Private Sub Worksheet_SelectionChange(ByVal Target As range)
'Private tells VBA to hide the sub from other programming elements (sub will
not appear in macro list either)
'Worksheet_SelectionChange tells the sub to "fire" whenever a cell is
selected in the worksheet
'ByVal Target As range


Set r = ActiveSheet.UsedRange.SpecialCells(xlCellTypeComme nts)
'Sets range as being on the active sheet, cells on worksheet being used,
display cell comment

r.comment.Visible = False
'Restores the comments status back to hidden when you leave the cell

If Intersect(Target, r) Is Nothing Then

Exit Sub
'If xxxx , then exit the sub

End If

Target.comment.Visible = True
'Otherwise, when move to cell, display any comments

End Sub
--
Thanks!

Dee


"Gary''s Student" wrote:

The hour glass probably comes from:

r.Comment.Visible = False

this line restores the comments to hidden when you leave the cell. If you
remove this line the routine will run much faster, but the comments will
remain visible when the cell is left.
--
Gary''s Student - gsnu20072