Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Place Comment into a cell

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Place Comment into a cell

Hi
AFAIK this is not possible as a comment change does not trigger any
event

--
Regards
Frank Kabel
Frankfurt, Germany

"terryv" schrieb im Newsbeitrag
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Place Comment into a cell

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Place Comment into a cell

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






  #5   Report Post  
Posted to microsoft.public.excel.programming
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










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Place Comment into a cell

David - Thanks for the response;
on your site (referenced) under your explanation of Worksheet_Activate Event
you use the language "when the sheet is opened".. could I interpret this
(event) as
being "when the sheet becomes the current sheet (receiving the focus (of the
cursor))"?
Sorry to split hairs, but until I do, I often find myself up-in-the-air...
Tks,
Jim

"David McRitchie" wrote in message
...
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










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Place Comment into a cell

Hi Jim,
Moving the cursor on a worksheet would be
Worksheet_SelectionChange event. Selecting a different sheet
is Worksheet_Activate event. So the answer to your
question about moving the cursor focus by itself is not
worksheet activation.

When a workbook is opened all cells are recalculated.
So you would not have any problems in that respect.

When a sheet tab is selected by itself that sheet is activated.

Simply being part of a grouped sheets selection and moving
the cursor does not activate the sheet.

If you select the same sheet as is already active, or move the
cursor around you are not activating the worksheet; therefore,
your change to the comment would not be picked up yet.

If you switch sheets and return the Worksheet_Activate event
will be triggered and the cell referencing the cell comment would
be updated. Likewise, if you simply double click that event
was set up to trigger the Worksheet_Activate event.

Removing Volatile and using the two event macros
is not foolproof, the user should be told how this works.
If they forget, chances are they will be selecting other sheets
and returning. If not it will still be corrected when the workbook
is reopened.

BTW, I also updated my ccomment.htm page to refer to the event.htm
page for the mycomment macro. But because of the use of volatile
I never did have it in the code/ccomment.txt page -- though I did add
it now as commented out.
---
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

"Jim May" wrote ...
David - Thanks for the response;
on your site (referenced) under your explanation of Worksheet_Activate Event
you use the language "when the sheet is opened".. could I interpret this
(event) as being "when the sheet becomes the current sheet (receiving
the focus (of the cursor))"?
Sorry to split hairs, but until I do, I often find myself up-in-the-air...


"David McRitchie" wrote in message
Read more about ... Event macros at
http://www.mvps.org/dmcritchie/excel...tm#recalculate



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Place Comment into a cell

Here's another version:

Sub tester()
x = ActiveCell.Comment.Text
mycell = Application.InputBox("To What Cell Do I Copy the Comment?")
Range(mycell).Value = x
End Sub



"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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I place a picture instead of words in a hidden comment box Christy81267 Excel Worksheet Functions 2 February 7th 09 04:35 PM
copy comment content to cell content as data not as comment Lilach Excel Discussion (Misc queries) 2 June 21st 07 12:28 PM
how can I place the content of a cel automaticly in a comment willie heijink Excel Discussion (Misc queries) 0 April 27th 07 09:46 AM
Place comment on chart Bill43 Charts and Charting in Excel 3 November 15th 06 03:15 PM
How do I place a .jpg image in an Excel comment? kjohnson1000 Excel Discussion (Misc queries) 6 July 19th 05 11:22 AM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"