View Single Post
 
Old 04-17-2019, 04:36 AM
Carol Gomez Carol Gomez is offline Windows 10 Office 2019
Novice
 
Join Date: Apr 2019
Posts: 1
Carol Gomez is on a distinguished road
Default Call info from the worksheet to create shapes in VBA

Hi,

I'm trying to write a code to automatically insert forms (rectagles) into my worksheet. I have over 200 entries to make with different sizes and names. I need the names to recognize which box this infomation corresponds to.

EX
Box W X H
AAAA 3.5 cm 2,05 cm
AAAB 2,4 cm 2,08 cm
.... .... .......

here the code I have till now:

Sub ShapeRectangle()
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
144, 144, 72, 72)
.Name = "Red Square"
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Line.DashStyle = msoLineDashDot
End With
End Sub

where to add a dynamic code to call the info from the worksheet?

thank you in advance for your answer!
best,

Carol
Reply With Quote