How to set cell to a comment from another cell?
How do I make one cell equal to the comment in another cell? One would think
that =comment(A1) would do it, but of course it doesn't. Can anyone help? |
You need a UDF (User Defined Function). Copy the UDF below...
'/=======================================/ Public Function Comment(rng As Range) 'rng must point to a single cell 'Get Text in a comment of one (1) cell Application.Volatile On Error GoTo err_Function Comment = rng.Comment.Text exit_Function: On Error Resume Next Exit Function err_Function: GoTo exit_Function End Function '/=======================================/ HTH, -- Gary Brown If this post was helpful, please click the ''''Yes'''' button next to ''''Was this Post Helpfull to you?". "Pete at Sappi Fine Paper" wrote: How do I make one cell equal to the comment in another cell? One would think that =comment(A1) would do it, but of course it doesn't. Can anyone help? |
Thanks! I actually wrote a program to populate all the cells in my sheet
with the comments in the cells on another sheet, and now that I've written it I might as well stick with it. However, now that you've taught me how to use UDFs, I'll no doubt do so frequently in future! Thanks very much! "Gary L Brown" wrote: You need a UDF (User Defined Function). Copy the UDF below... '/=======================================/ Public Function Comment(rng As Range) 'rng must point to a single cell 'Get Text in a comment of one (1) cell Application.Volatile On Error GoTo err_Function Comment = rng.Comment.Text exit_Function: On Error Resume Next Exit Function err_Function: GoTo exit_Function End Function '/=======================================/ HTH, -- Gary Brown If this post was helpful, please click the ''''Yes'''' button next to ''''Was this Post Helpfull to you?". "Pete at Sappi Fine Paper" wrote: How do I make one cell equal to the comment in another cell? One would think that =comment(A1) would do it, but of course it doesn't. Can anyone help? |
All times are GMT +1. The time now is 04:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com