Move Shape lower

haseft

Active Member
Joined
Jun 10, 2014
Messages
321
hi!

The following codes draw a shape in Active cell.
I want to move the shape a litle bit lower in active cell.
RowHeight = 50
Shape height = 20
Tanks for helping.

Sub DrawShape()
Dim ShapeName1 As String
With Selection
l = .Left
t = .Top
w = .Width
End With

ActiveCell.RowHeight = 50
ShapeName1 = "Objekt1"
With ActiveSheet.Shapes.AddShape(1, l, t, w, 20)
.Name = ShapeName1
End With

ActiveSheet.Shapes(ShapeName1).Fill.ForeColor.SchemeColor = 3

'I want to move ShapeNeme1 a litle bit lower
'code .....

End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Code:
Sub DrawShape()
  With ActiveWindow.RangeSelection
    .Rows(1).RowHeight = 50
    With .Worksheet.Shapes.AddShape(Type:=msoShapeRectangle, _
                                    Left:=.Left, _
                                    Top:=.Top[COLOR="#FF0000"][B] + 1[/B][/COLOR], _
                                    Width:=.Width, _
                                    Height:=20)
      .Name = "Objekt1"
      .Fill.ForeColor.SchemeColor = 3
    End With
  End With
End Sub
 
Upvote 0
Solution
Thanks shg, its working.


Code:
Sub DrawShape()
  With ActiveWindow.RangeSelection
    .Rows(1).RowHeight = 50
    With .Worksheet.Shapes.AddShape(Type:=msoShapeRectangle, _
                                    Left:=.Left, _
                                    Top:=.Top[COLOR=#ff0000][B] + 1[/B][/COLOR], _
                                    Width:=.Width, _
                                    Height:=20)
      .Name = "Objekt1"
      .Fill.ForeColor.SchemeColor = 3
    End With
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,483
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top