View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Issue with 'Left' in macro

I duplicated your code with the same type of autoshape (trapezoid from
Autoshape flowchart) with the following results for the .Left property of the
ShapeRange (original value : result value):
230.25 : 260.25
570.75 : 430.5
290:290

So unless the original .Left is 290 (or very close) the code seems to move
it. One question did come to mind: Is this shape part of a group of shapes?
The ShapeRange refers to the entire group, so if you have grouped the
trapezoid with any other shapes you are setting the left edge of the group,
not the left edge of your trapezoid. That might explain the results you are
getting.

--
- K Dales


"K Dales" wrote:

What is the original .Left value for the ShapeRange for your AutoShape 1?
Note that if it was already 290, the result would be 290. But I will
continue to look at the code to see if I can find any other issues.
--
- K Dales


"Linking to specific cells in pivot table" wrote:

Hi - this is driving me crazy -- below is code to re-size an object and then
move it -- what seems to be happening is that the it is not being moved as
the code specifies. I have five other blocks of code for five other objects
-- the blocks of code are identical -- and the other five objects are being
moved as specified by the code. Any help is really appreciated!!

'After executing the below code, the object has a 'Left' position of 290 --
as the code specifies, it should be a different number than 290

Sub changepctg()

'M9 = 100
'M10 = 100
'F7 = 0.012
'AutoShape1 = a trapezoid from the "Autoshape" - "Flowchart" menu

Sheets("1st Level Graph (2)").Select

ActiveSheet.Shapes("AutoShape 1").Select
Selection.ShapeRange.Height = Range("M9").Value
Selection.ShapeRange.Width = Range("M10").Value * (1 +
(Range("F7").Value - 0.5))
ActiveSheet.Shapes("AutoShape 1").Select
Selection.ShapeRange.Top = ((Selection.ShapeRange.Top - 15) / 2) + 15
Selection.ShapeRange.Left = ((Selection.ShapeRange.Left - 290) / 2) + 290