View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default Place Comment into a cell

Hi Terry,
Another way would be to remove the Volatile line from the code.
then do your own Ctrl+Alt+F9 to recalculate all worksheets

To automate that you could use an Event macro that is triggered by
some other event, because as Frank indicated there is no event macro
for changing a comment. This will cause the recalculation to occur
whenever you second sheet with the formulas is activated, the macro
would normally not just have one line in it. The double click event macro
simply activates the worksheet activate macro so you use the same code,
but can see the effect without changing worksheets.

Right click on the worksheet tab, view code and insert the following
after your Option Explicit

Private Sub Worksheet_Activate()
'-- in use to avoid use of volatile
Application.CalculateFull ' ctrl-alt-f9
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True 'get out of edit mode from DoubleClick
Worksheet_Activate
End Sub


Read more about this at and Event macros at
http://www.mvps.org/dmcritchie/excel...tm#recalculate
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"terryv" wrote in message ...
Hey Jim
Thank a million it works great.... exactly what I needed....
Anytime I do anything on my worksheets though, it takes a long time to
recalculate the sheets .... I see it calculating on the bottom left. Is
there a way to speed this up?

Thanks Jim
Terry V


"Jim May" wrote in message
news:TvTjd.88659$UA.18707@lakeread08...
try the UDF:

Function MyComment(rng As Range)
Application.Volatile
Dim str As String
str = Trim(rng.Comment.Text)
'// Next line removes Chr(10) character from string
str = Application.Substitute(str, vbLf, " ")
MyComment = str
End Function

Then with your cell a4 including a comment, in cell B5 enter
=MyComment(A4)

HTH


"terryv" wrote in message
...
Hello
Is there anyway to take a comment from a cell and place it in another

cell's
content?

If a comment is added to a cell on Sheet1, after the comment is closed
(finished), I would like to have the cell content of another sheet be

the
comment content.

Kinda like a OnChange for a comment.

Thank you
Terry