![]() |
Hide all open comments in a particular range
Hi I have a range of cells on a sheet that have comments the user can make visible. I know how to hide one cells comments: Code: -------------------- Range("a1").Select ActiveCell.Comment.Visible = False -------------------- vut what if there are several comments open in range("a1:a30")? Is there a way to close them all at one time *without* employing the universal command to hide all comments throughout the workbook? Many thanks tx -- tx12345 ------------------------------------------------------------------------ tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776 View this thread: http://www.excelforum.com/showthread...hreadid=574355 |
Hide all open comments in a particular range
Some vba like the following should toggle the visibility of the comments in
the current selection: Sub clrComment() Dim rng As Range For Each rng In Selection If Not rng.Comment Is Nothing Then rng.Comment.Visible = Not rng.Comment.Visible End If Next rng End Sub Hope that helps, TK "tx12345" wrote: Hi I have a range of cells on a sheet that have comments the user can make visible. I know how to hide one cells comments: Code: -------------------- Range("a1").Select ActiveCell.Comment.Visible = False -------------------- vut what if there are several comments open in range("a1:a30")? Is there a way to close them all at one time *without* employing the universal command to hide all comments throughout the workbook? Many thanks tx -- tx12345 ------------------------------------------------------------------------ tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776 View this thread: http://www.excelforum.com/showthread...hreadid=574355 |
Hide all open comments in a particular range
That is a nice little piece of code, thanks. But I can't figure out how to make it only toggle off. is there a way to customize the code so it only closes the comments and not opens them? thanks again tx -- tx12345 ------------------------------------------------------------------------ tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776 View this thread: http://www.excelforum.com/showthread...hreadid=574355 |
Hide all open comments in a particular range
If you only want to make the comments invisible change the code from
rng.Comment.Visible = Not rng.Comment.Visible to rng.Comment.Visible = False TK "tx12345" wrote: That is a nice little piece of code, thanks. But I can't figure out how to make it only toggle off. is there a way to customize the code so it only closes the comments and not opens them? thanks again tx -- tx12345 ------------------------------------------------------------------------ tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776 View this thread: http://www.excelforum.com/showthread...hreadid=574355 |
All times are GMT +1. The time now is 05:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com