Where to place the code:
This code goes in a standard module.
Code required:
Code:
Option Explicit Private Const lDefaultCommentColor As Long = 14811135 Private Sub RestoreCommentColor(wks As Worksheet) 'Author : Ken Puls (www.excelguru.ca) 'Macro Purpose: To return all comments to the specified color Dim cl As Range On Error Resume Next For Each cl In wks.UsedRange.SpecialCells(xlCellTypeComments) cl.Comment.Shape.Fill.ForeColor.RGB = lDefaultCommentColor Next cl On Error GoTo 0 End Sub
Call the RestoreCommentColor subroutine (passing it a worksheet variable) from within your code, as shown in the examples below:
Code:
Sub RestoreActiveComments() 'Author : Ken Puls (www.excelguru.ca) 'Macro Purpose: Restore the Comment colour for the active sheet Call RestoreCommentColor(ActiveSheet) End Sub Sub RestoreAllComments() 'Author : Ken Puls (www.excelguru.ca) 'Macro Purpose: Restore the Comment colour for the all sheets Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets Call RestoreCommentColor(wks) Next wks End Sub
Code:
?RGB(0, 255, 0)



Knowledge Base Articles By Category
Donations
Recent Forum Posts
