VBA Shapes

N

NPell

Hi all,

Im trying to create a macro to create a shape, based on cell
references.

Creating the shape is fine, but its pulling in the cell values for the
shape size that is proving difficult.
I have the following, which doesnt work, but might give you an idea of
what im trying to achieve.

shpht = Range("K2").Value
shpwd = Range("K3").Value

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 0, 0#, shpwd,
shpht).
Select

Can anybody help?
 
N

NPell

Hi all,

Im trying to create a macro to create a shape, based on cell
references.

Creating the shape is fine, but its pulling in the cell values for the
shape size that is proving difficult.
I have the following, which doesnt work, but might give you an idea of
what im trying to achieve.

    shpht = Range("K2").Value
    shpwd = Range("K3").Value

    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 0, 0#, shpwd,
shpht).
        Select

Can anybody help?

Oh, it does work, its the syntax that was wrong, no underscore to lead
to the Select on the next line.
Sorry all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top