VBA to create, place and name Shape from Values in cells

platypus007

New Member
Joined
Oct 24, 2019
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I need help with this: In cells A1:A6 I have Name of Shape In B1:B6 I have refference to another cell in form D2 in cell B1 , E3 in cell B2 , C6 in cell B3 and so on.
I need to create multiple Circular Shapes named after A1:A6 and placed into refference cells, which is in B1:B6 and loop this (creating shapes) till last A value.


IGvvlj1.jpg


https://pasteboard.co/IGvvlj1.jpg

Thanks Viktor
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about
Code:
Sub platypus()
    Dim Shp As Shape
    Dim Cl As Range
    
    For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
        Set Shp = Sheet12.Shapes.AddShape(msoShapeOval, 1, 1, 10, 10)
        Shp.Name = Cl.Value
        With Range(Cl.Offset(, 1).Value)
            Shp.Top = .Top + (.Height / 2) - 5
            Shp.Left = .Left + (.Width / 2) - 5
        End With
    Next Cl
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,949
Members
448,534
Latest member
benefuexx

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