Dropping a shape onto a sheet

BallGazer

Board Regular
Joined
Jul 16, 2008
Messages
110
Hi Guys

I'm not that great with VBA but I use the code
<CODE>
Sub circ()
ActiveCell.Offset(0, 0).Select
ActiveSheet.Shapes.AddShape(msoShapeOval, 297#, 390#, 123.75, 104.25). _
Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.Weight = 2#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 20
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
End Sub

</CODE>

to draw a no-fill shape on the sheet. I use it to flag areas where I need to come back to check something out. the 297#, 390# in
ActiveSheet.Shapes.AddShape(msoShapeOval, 297#, 390#, 123.75, 104.25).Select

means that the shape appears 297 points from the left etc. I am looking for some code that will drop the shape near to the active cell.

Any ideas greatly appreciated.

BG
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try

Code:
Sub circ()
ActiveCell.Offset(0, 0).Select
ActiveSheet.Shapes.AddShape(msoShapeOval, 297#, 390#, 123.75, 104.25). _
Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.Weight = 2#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 20
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.Top = ActiveCell.Top
Selection.Left = ActiveCell.Left
End Sub
 
Upvote 0
Perhaps:-
Code:
ActiveSheet.Shapes.AddShape(msoShapeOval, ActiveCell.Top, ActiveCell.Left, 123.75, 104.25). _
Select
 
Upvote 0
Code:
Sub circ()
    With ActiveCell
        With ActiveSheet.Shapes.AddShape(msoShapeOval, _
                                         .Left, .Top + (.Height - .Width) / 2, _
                                         .Width, .Width)
            .Fill.Visible = msoFalse
            .Line.Weight = 2#
            .Line.DashStyle = msoLineSolid
            .Line.Style = msoLineSingle
            .Line.Transparency = 0#
            .Line.Visible = msoTrue
            .Line.ForeColor.SchemeColor = 20
            .Line.BackColor.RGB = RGB(255, 255, 255)
        End With
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,628
Messages
6,186,103
Members
453,337
Latest member
fiaz ahmad

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