Finding comments
Is it possible to move through some data and determine if there is a comment
in the cell in question? I want to go through a range of cells and if the macro finds a comment, I want to display a msgbox. Thanks for the help..... -- JT |
Finding comments
This code should work...
Public Sub CommentsMessage() Dim rngFoundComments As Range Dim rng As Range On Error Resume Next Set rngFoundComments = Range("A1:Z100").SpecialCells(xlCellTypeComments) On Error GoTo 0 If rngFoundComments Is Nothing Then MsgBox "No Comments" Else For Each rng In rngFoundComments MsgBox rng.Comment.Text Next rng End If End Sub -- HTH... Jim Thomlinson "JT" wrote: Is it possible to move through some data and determine if there is a comment in the cell in question? I want to go through a range of cells and if the macro finds a comment, I want to display a msgbox. Thanks for the help..... -- JT |
Finding comments
This is worth a look:
http://www.contextures.com/xlcomment...l#CopyAdjacent This too: http://www.contextures.com/xlcomments03.html#Show All that code comes from he http://www.contextures.com/xlcomments03.html#Top HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Jim Thomlinson" wrote: This code should work... Public Sub CommentsMessage() Dim rngFoundComments As Range Dim rng As Range On Error Resume Next Set rngFoundComments = Range("A1:Z100").SpecialCells(xlCellTypeComments) On Error GoTo 0 If rngFoundComments Is Nothing Then MsgBox "No Comments" Else For Each rng In rngFoundComments MsgBox rng.Comment.Text Next rng End If End Sub -- HTH... Jim Thomlinson "JT" wrote: Is it possible to move through some data and determine if there is a comment in the cell in question? I want to go through a range of cells and if the macro finds a comment, I want to display a msgbox. Thanks for the help..... -- JT |
Finding comments
Do you need to "stop" at the cell when you display the message, or would
just knowing that somewhere in the range is a cell with a comment be sufficient? If the latter, then try something like this (change the range to suit your needs)... Dim R As Range On Error Resume Next Set R = Range("A1:Z26").SpecialCells(xlCellTypeComments) If Not R Is Nothing Then MsgBox "The range has a comment in it." -- Rick (MVP - Excel) "JT" wrote in message ... Is it possible to move through some data and determine if there is a comment in the cell in question? I want to go through a range of cells and if the macro finds a comment, I want to display a msgbox. Thanks for the help..... -- JT |
All times are GMT +1. The time now is 11:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com