hi,
The current code i have to make this work is as follows, but it is clunky and causing the worksheet to be incredibly slow.
Any ideas if i can achieve the same outcome in a simpler way?
I want column H to have cells that i can click and a comment box will instantly open up in the centre of the screen.
The current code i have to make this work is as follows, but it is clunky and causing the worksheet to be incredibly slow.
Any ideas if i can achieve the same outcome in a simpler way?
I want column H to have cells that i can click and a comment box will instantly open up in the centre of the screen.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim cTop As Long
Dim cWidth As Long
Dim cmt As Comment
Dim Sh As Shape
Application.DisplayCommentIndicator _
= xlcommentIndicator0nly
Set rng = ActiveWindow.VisibleRange
cTop = rng.Top + rng.Height / 2
cWidth = rng.Left + rng.Width / 2
If ActiveCell.Comment Is Nothing Then
'do nothing
Else
Set cmt = ActiveCell.Comment
Set Sh = cmt.Shape
Sh.Top = cTop - Sh.Height / 2
Sh.Left = cWidth - Sh.Width / 2
cmt.Visible = True
End If
End Sub