1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub Draw_Line()
Dim Position_Centre_X
Dim Position_Centre_Y
Dim Point_Cercle_X
Dim Point_Cercle_Y
Dim Rayon
Rayon = 250 ' = Diamètre / 2 (Diamètre = 500 que vous avez donné pour votre cercle)
Position_Centre_X = 262 ' = Rayon + 12 (12 pour position que vous avez donné pour votre cercle)
Position_Centre_Y = 256.75 ' = Rayon + 6.75 (6.75 pour position que vous avez donné pour votre cercle)
'=============================================================================
'=============================================================================
'Position point sur cercle selon angle
'Formule mathématique
'x = x0 + r*cos(t)
'y = y0 + r*sin(t)
'où (x0,y0) sont les coord du centre, r est le rayon, et t l'angle en radian
'1 degré = 0.0174532925 Radian
Point_Cercle_X = Position_Centre_X + (Rayon * Cos(Cells(1, 1) * -0.0174532925))
Point_Cercle_Y = Position_Centre_Y + (Rayon * Sin(Cells(1, 1) * -0.0174532925))
'=============================================================================
'=============================================================================
With ActiveSheet.Shapes.AddLine(Position_Centre_X, Position_Centre_Y, Point_Cercle_X, Point_Cercle_Y).Line
.Weight = 2.25
.ForeColor.RGB = RGB(255, 0, 0)
End With
End Sub |
Partager