• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3232
  • Last Modified:

Excel VBA Add shape inside a cell/range

Hi

What VBA code would I use to add a shape and position it inside an Excel cell or range

Thanks
0
Murray Brown
Asked:
Murray Brown
1 Solution
 
ProfessorJimJamCommented:
try this one.

Sub AddsSHPcellRANGE()

Dim SSLeft As Double
Dim SSTop As Double
Dim SSWidth As Double
Dim SSHeight As Double

Dim SS As Range
Dim shpOval As Shape

Set SS = Range(Selection.Address)  ' change if you want specific cell <-- Range("a1")

SSLeft = SS.Left
SSTop = SS.Top
SSHeight = SS.Height
SSWidth = SS.Width

Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, SSLeft, SSTop, 10, 10)


End Sub

Open in new window

0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now