zoom38
10-15-2007, 06:09 PM
I have another issue with comments. I have the following code in a Worksheet change event for formatting comments.
Dim cell As Range
For Each cell In Cells.SpecialCells(xlCellTypeComments)
With cell.Comment.Shape.TextFrame
.Characters.Font.Name = "Tahoma"
.Characters.Font.Size = 14
.Characters.Font.Bold = True
.Characters.Font.ColorIndex = 1 'Black
.AutoSize = True
End With
cell.Comment.Shape.TextFrame.AutoSize = True
Next cell
It works great except if there are no comments. If there aren't any comments I get a "No Cells were Found" error and it stops and highlights the For line.
Any ideas on how to fix it?
Thanks
Gary
Dim cell As Range
For Each cell In Cells.SpecialCells(xlCellTypeComments)
With cell.Comment.Shape.TextFrame
.Characters.Font.Name = "Tahoma"
.Characters.Font.Size = 14
.Characters.Font.Bold = True
.Characters.Font.ColorIndex = 1 'Black
.AutoSize = True
End With
cell.Comment.Shape.TextFrame.AutoSize = True
Next cell
It works great except if there are no comments. If there aren't any comments I get a "No Cells were Found" error and it stops and highlights the For line.
Any ideas on how to fix it?
Thanks
Gary