Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Delete Comment if contents = "HIDDEN FORMULA"

Excel Experts,

A spreadsheet I inherited is overrun with comments which say "HIDDEN
FORMULA!" and I'd like to delete all of these comments. The spreadsheet has
some useful comments so I don't want to delete every comment.

When I used the macro recorder to figure out the Text of these comments, I
got a line back

Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""

So I think my code should be something like,

Dim C as Comment
For Each C in ActiveSheet.Comments
If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
CellofComment.ClearComments
End Sub

I realize the "CellofComment" isn't the right way to reference the cell
which contains the comment.

Thanks in advance.

Alan

--
achidsey
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete Comment if contents = "HIDDEN FORMULA"

Hi Alan,

Try:

'==================
Sub TesterA()
Dim C As Comment
For Each C In ActiveSheet.Comments
If InStr(1, C.Text, _
"HIDDEN FORMULA!", vbTextCompare) Then
C.Delete
End If
Next C

End Sub
'<<==================

---
Regards,
Norman



"achidsey" (notmorespam) wrote in message
...
Excel Experts,

A spreadsheet I inherited is overrun with comments which say "HIDDEN
FORMULA!" and I'd like to delete all of these comments. The spreadsheet
has
some useful comments so I don't want to delete every comment.

When I used the macro recorder to figure out the Text of these comments, I
got a line back

Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""

So I think my code should be something like,

Dim C as Comment
For Each C in ActiveSheet.Comments
If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
CellofComment.ClearComments
End Sub

I realize the "CellofComment" isn't the right way to reference the cell
which contains the comment.

Thanks in advance.

Alan

--
achidsey



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Delete Comment if contents = "HIDDEN FORMULA"

Norman,

Worked perfectly.

Thanks, Alan


--
achidsey


"Norman Jones" wrote:

Hi Alan,

Try:

'==================
Sub TesterA()
Dim C As Comment
For Each C In ActiveSheet.Comments
If InStr(1, C.Text, _
"HIDDEN FORMULA!", vbTextCompare) Then
C.Delete
End If
Next C

End Sub
'<<==================

---
Regards,
Norman



"achidsey" (notmorespam) wrote in message
...
Excel Experts,

A spreadsheet I inherited is overrun with comments which say "HIDDEN
FORMULA!" and I'd like to delete all of these comments. The spreadsheet
has
some useful comments so I don't want to delete every comment.

When I used the macro recorder to figure out the Text of these comments, I
got a line back

Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""

So I think my code should be something like,

Dim C as Comment
For Each C in ActiveSheet.Comments
If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
CellofComment.ClearComments
End Sub

I realize the "CellofComment" isn't the right way to reference the cell
which contains the comment.

Thanks in advance.

Alan

--
achidsey




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 to ignore hidden columns in an "Average" formula? DotK Excel Discussion (Misc queries) 8 January 1st 10 01:49 PM
Convert cell "contents" into a "comment" Ryan Excel Discussion (Misc queries) 4 October 3rd 08 11:34 PM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
how to increase size of "name box" and "contents of cell " displa. Stubby- LIBERTY New Users to Excel 2 February 22nd 07 06:43 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


All times are GMT +1. The time now is 03:59 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"