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
| Dim k As Integer
Dim n As Integer ' nombfre d'élément
Dim I As Integer 'Premier noeud
Dim J As Integer ' Deuxieme noeud
Dim xi As Variant 'coordonnée x du noeud I
Dim yi As Variant ' coordonnée y du noeud I
Dim xj As Variant ' coordonnée x du noeud J
Dim yj As Variant ' coordonnée y du noeud J
Dim a As Integer 'Variable qui nous servira à balayer le Tableau des Elements
Dim b As Integer ' Variable qui nous serviras a balayer le Tableau des Noeuds
b = 15
a = 3
Worksheets("Graphique").Select
Worksheets("Graphique").Cells.Clear
n = InputBox("nombre d'éléments")
For k = 8 To n + 8
I = Cells(k, b).Value 'On regarde le premier noeud
J = Cells(k, b + 1).Value ' On regarde le deuxième Noeud
xi = Cells(I + 7, a).Value
yi = Cells(I + 7, a + 1).Value
xj = Cells(J + 7, a).Value
yj = Cells(J + 7, a + 1).Value
ActiveSheet.Shapes.AddLine((xi * 100) + 100, (xj * 100) + 100, (yi * 100) + 100, (yj * 100) + 100).Select
Next k |
Partager