Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,074
- Office Version
- 2019
- Platform
- Windows
I have this code that displays msgbox. However its dependent on the row selected. How can I click the red triangle to display the msgbox without having the need to have the row selected?
VBA Code:
Sub Callout()
Dim shMsg As Shape, shID
Dim cel As Range
On Error Resume Next
shID = ActiveSheet.Shapes("Callout").ID
If Not IsEmpty(shID) Then
ActiveSheet.Shapes("Callout").Delete
ElseIf Not Range("S" & ActiveCell.Row).Comment Is Nothing Then
Set shMsg = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangularCallout, 112.5, 112.5, 150, 1)
Set cel = Range("S" & ActiveCell.Row)
With shMsg
.Name = "Callout"
.TextFrame.Characters.Text = Range("S" & ActiveCell.Row).Comment.Text
.Left = cel.Left - .Width
.Top = cel.Offset(1).Top
.Adjustments.Item(1) = 0.52
.Adjustments.Item(2) = -0.65
.TextFrame2.AutoSize = msoAutoSizeShapeToFitText
End With
End If
End Sub