ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell comments (https://www.excelbanter.com/excel-programming/450637-cell-comments.html)

davidman

Cell comments
 
Hi

Is there a way to check if a cell has a comment which contains a string?

What I want to do (in pseudo code) is
Code:

If Range("A1").comment.text contains "My String" Then
'Do Stuff
End If


Claus Busch

Cell comments
 
Hi,

Am Thu, 5 Feb 2015 09:55:23 +0000 schrieb davidman:

Is there a way to check if a cell has a comment which contains a
string?


try:

Sub CommentCheck()
With Range("A1")
If Not .Comment Is Nothing And _
InStr(.Comment.Text, "MyString") Then
'Do stuff
End If
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com