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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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