ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Decide comment format 'globally'? Restore format with ws_change? (https://www.excelbanter.com/excel-discussion-misc-queries/139052-decide-comment-format-globally-restore-format-ws_change.html)

tskogstrom

Decide comment format 'globally'? Restore format with ws_change?
 
Hi,
I want to show all comments with same format to suit my design. I
didn't find any choice in 'options', unfortunately. Anybody knowing a
good way? What about the way below:

I'm thinking of calling a 'reformat' sub from
worksheet_selectionchange or _change like 'Call CommentFormat(Target)'
to below Sub.

I'm not sure of the object levels, I get error on ' With
rng.Comment.ShapeRange.Font' and 'If Not rng.Comment Is Nothing Then'
always passe code thorugh even then there is no comment etc.


Sub Worksheet_SelectionChange(ByVal Target As Range)
'**************************
If TypeName(Target) = "Range" Then
Call CommentFormat(Target)
End if
End sub


Sub CommentFormat(rng As Range)
'**************************
If Not rng.Comment Is Nothing Then
With rng.Comment.ShapeRange.Font
.Name = "Arial Narrow"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With

rng.Comment.ShapeRange.Fill.Visible = msoTrue
rng.Comment.ShapeRange.Fill.Solid
rng.Comment.ShapeRange.Fill.ForeColor.SchemeColor = 51
rng.Comment.ShapeRange.Fill.Transparency = 0.3
rng.Comment.ShapeRange.line.Weight = 0.25
rng.Comment.ShapeRange.line.DashStyle = msoLineSolid
rng.Comment.ShapeRange.line.Style = msoLineSingle
rng.Comment.ShapeRange.line.Transparency = 0#
rng.Comment.ShapeRange.line.Visible = msoTrue
rng.Comment.ShapeRange.line.ForeColor.SchemeColor = 8
rng.Comment.ShapeRange.line.BackColor.RGB = RGB(255, 255, 255)
With rng.Comment
.Locked = True
.LockedText = True
End With

End if
End Sub

(When I get this work, I intend to check each format and only change
if it is false)

Happy to all support,
Kind regards
Tskogstrom



All times are GMT +1. The time now is 04:12 AM.

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