ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Position the shape (https://www.excelbanter.com/excel-programming/381415-re-position-shape.html)

JE McGimpsey

Position the shape
 
One way (without the unnecessary selection):

With ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
With .Parent.Shapes.AddShape( _
Type:=msoShapeFlowchartDecision, _
Left:=3.75, _
Top:=.Top, _
Width:=138.75, _
Height:=95.25)
.TextFrame.Characters.Text = "xxx"
End With
End With


In article ,
ak wrote:

May I know what should be code to add
msoShapeFlowchartDecision,msoTextOrientationHorizo ntal

The shape should be right under the last used row. For example.
The last used row is 15, then these 2 shape will be added in range(A16)

I have used the following to add the shape, but the shape is then added in
the fixed position
ActiveSheet.Shapes.AddShape(msoShapeFlowchartDecis ion, 3.75, 651#, 138.75, _
95.25).Select
' ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 26.25,
688.5, _
94.5, 24#).Select
Selection.Characters.Text = "XXX"

Thanks for your help in advance


AK

Position the shape
 
Thanks very much. It works for adding one Shape.
If I want to add a msoTextOrientationHorizontal with TEXT ("XXX") on top of
this msoShapeFlowchartDecision, how should I write the code


"JE McGimpsey" wrote:

One way (without the unnecessary selection):

With ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
With .Parent.Shapes.AddShape( _
Type:=msoShapeFlowchartDecision, _
Left:=3.75, _
Top:=.Top, _
Width:=138.75, _
Height:=95.25)
.TextFrame.Characters.Text = "xxx"
End With
End With


In article ,
ak wrote:

May I know what should be code to add
msoShapeFlowchartDecision,msoTextOrientationHorizo ntal

The shape should be right under the last used row. For example.
The last used row is 15, then these 2 shape will be added in range(A16)

I have used the following to add the shape, but the shape is then added in
the fixed position
ActiveSheet.Shapes.AddShape(msoShapeFlowchartDecis ion, 3.75, 651#, 138.75, _
95.25).Select
' ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 26.25,
688.5, _
94.5, 24#).Select
Selection.Characters.Text = "XXX"

Thanks for your help in advance



JE McGimpsey

Position the shape
 
Do it the same way as I showed in the example I gave:

With ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
With .Parent.Shapes.AddShape( _
Type:=msoShapeFlowchartDecision, _
Left:=3.75, _
Top:=.Top, _
Width:=138.75, _
Height:=95.25)
End With
With .Parent.Shapes.AddShape( _
Type:=msoTextOrientationHorizontal, _
Left:=26.25, _
Top:=.Top + 37.5, _
Width:=94.5, _
Height:=24)
.TextFrame.Characters.Text = "xxx"
End With
End With


In article ,
ak wrote:

Thanks very much. It works for adding one Shape.
If I want to add a msoTextOrientationHorizontal with TEXT ("XXX") on top of
this msoShapeFlowchartDecision, how should I write the code


"JE McGimpsey" wrote:

One way (without the unnecessary selection):

With ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
With .Parent.Shapes.AddShape( _
Type:=msoShapeFlowchartDecision, _
Left:=3.75, _
Top:=.Top, _
Width:=138.75, _
Height:=95.25)
.TextFrame.Characters.Text = "xxx"
End With
End With



All times are GMT +1. The time now is 03:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com