Option Explicit
Private WithEvents cmbrs As CommandBars
Private Const COMMENT_RANGE_ADDR As String = "Sheet1!A1"
Private Sub Workbook_Open()
Set cmbrs = Application.CommandBars
Call cmbrs_OnUpdate
End Sub
Private Sub cmbrs_OnUpdate()
Static i As Long
With Range(COMMENT_RANGE_ADDR).Comment.Shape.Line
.DashStyle = (i Mod 2) + 4
.Weight = 2
End With
i = IIf(i = 1, 0, i + 1)
End Sub
Thanks Jafaar. It works perfectly, when A double click on any cell
Strange! The code I posted works automatically for me without the need to click a cell or do anything.Hi Jafaar
I have set up a dashed-line around the border of my comments. The marching ants scenario only works if I click on a cell. It is not automatic
Option Explicit
Private WithEvents cmbrs As CommandBars
Private Const COMMENT_RANGE_ADDR As String = "Sheet1!A1"
Private Sub Workbook_Open()
Set cmbrs = Application.CommandBars
Call cmbrs_OnUpdate
End Sub
Private Sub cmbrs_OnUpdate()
Static i As Long
With Range(COMMENT_RANGE_ADDR).Comment.Shape.Line
.DashStyle = (i Mod 2) + 4
.Weight = 2
End With
Application.CommandBars.FindControl(ID:=2040).Enabled = i
i = IIf(i = 1, 0, i + 1)
End Sub