View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jjk jjk is offline
external usenet poster
 
Posts: 42
Default Centering a Shape over a given cell when resizing

Is this what you want??

ActiveSheet.Shapes("AutoShape 18").Select

sourceVar = Range("A1").Value - 0.167 + 1

prevCenterH = Selection.ShapeRange.Left +
(Selection.ShapeRange.Width / 2)
prevCenterV = Selection.ShapeRange.Top +
(Selection.ShapeRange.Height / 2)

If sourceVar < 1.5 Then
Selection.ShapeRange.Height = 83.57763975 * sourceVar
Selection.ShapeRange.Width = 99.1875 * sourceVar
Else
Selection.ShapeRange.Height = 83.57763975 * 1.5
Selection.ShapeRange.Width = 99.1875 * 1.5
End If

Selection.ShapeRange.Left = prevCenterH -
(Selection.ShapeRange.Width / 2)
Selection.ShapeRange.Top = prevCenterV -
(Selection.ShapeRange.Height / 2)


Regards,
Jayant