Forum Discussion

jragan's avatar
jragan
Copper Contributor
Nov 05, 2021

Object positioning

I have an excel worksheet that creates a diagram.    Below are attached the original creation of the diagram and also the new version of the diagram from the modified program.  The user wants to know why things are not lining up in the new version like they did in the old version.  I find nowhere in any of the code related to the worksheet where positioning is determined to place the items in the diagram.  Can anyone point me as to how to correct the problem?

 

Thanks.

8 Replies

  • jragan 

    I can see why your client is not totally thrilled.  If you go into the VBA, shape positions may be set by using their .left and .top properties.  Ranges also return such properties so the shape could either be set by the location in points or set to match the grid.

    Set shp = Sheet1.Shapes(1)
    shp.left = rng.left
    shp.Top = rng.Top
    shp.Rotation = 45
    • jragan's avatar
      jragan
      Copper Contributor
      Peter,
      Thank you for your reply. The problem for me is that I do not see any code that is assigning position to any shape as you have demonstrated above. I will keep looking though.

      Thank you again.

      John
      • PeterBartholomew1's avatar
        PeterBartholomew1
        Silver Contributor
        John
        How was the diagram created? Was it simply a diagram created by hand? Changing the size of the underlying mesh can change the shapes, depending on their settings. Rotating shapes is unusual, though.

Resources