Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

How do format each comment in an excel spreadsheet?

$
0
0

I would like to format all the existing comments in my active excel spreadsheet. I have been trying to use the following code:

Public Sub FormatNote()
 If Not ActiveCell.Comment Is Nothing Then
  OrganizeElements
 End If
End Sub

Public Sub FormatNotes()
 For Each ????? In ActiveSheet.Comments
  OrganizeElements
 Next
End Sub

Public Sub OrganizeElements()
 ActiveCell.Comment.Shape.TextFrame.AutoSize = True
 'And many other formats
End Sub

Formatting a single comment works. However, formatting all the comments does not. What do I use after the "For Each"? Originally, I was using "Dim Note as Comment" and then using "For Each Note..." and that seemed to work OK but it had other problems. I am trying not to use variables until I understand the code more fundamentally. How do I refer to each or all existing comments in the active sheet and then do something with them?

Thank you


Viewing all articles
Browse latest Browse all 88835


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>