insert shape as specific location

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,075
Office Version
  1. 2019
Platform
  1. Windows
I'm using a code to insert a red triangle in a cell. When I click on the triangle, I will have a message box appear.

Two things: (Note: The activecell will always be in column A)

1. How can I place the msgbox shape in the location as it appears in the picture.
2. How can I place the pointer pointed at the red triangle as it appears in the picture. (Note: The red triangle will always be in the top left corner)

1594903225096.png


VBA Code:
Sub Callout()
Dim shCallout As Shape

Set shCall = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangularCallout, 112.5, 112.5, 89.25, 60)

With shCall
    .Name = "Callout"
    .TextFrame.Characters.Text = ActiveCell.Offset(, 18).Comment.Text
End With
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
To bump after only 30 minutes shows unbelievable impatience ?
Is this what you want ?
shape in sheet.jpg
 
Upvote 0
Yes and bring the pointer to point to the red triangle in the upper left corner of the cell.

Forgive my impatience.
 
Upvote 0
Try this
VBA Code:
Sub Callout()
    Dim shCallout As Shape, cel As Range
    Set shCallout = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangularCallout, 112.5, 112.5, 89.25, 60)
    Set cel = ActiveCell.Offset(, 18)
    shCallout.Select
        
    With Selection.ShapeRange
        .Adjustments.Item(1) = 0.45
        .Adjustments.Item(2) = -0.7
        .TextFrame.Characters.Text = ActiveCell.Offset(, 18).Comment.Text
        .Name = "Callout"
        .Left = cel.Left - .Width
        .Top = cel.Offset(1).Top
    End With
End Sub

This is the result I get
shape in sheet.jpg
 
Upvote 0
Perfect. Thank you Yongle.

PS. I will be more patient to allow someone to answer my question in the future.
 
Upvote 0

Forum statistics

Threads
1,215,753
Messages
6,126,678
Members
449,327
Latest member
John4520

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top