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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Sub test()
Dim Cible As Integer, DerLigne As Integer, y As Integer
Dim chemin As String, Resultat As String, Rep_1 As String, ep_2 As String
Dim Cell As Range
Dim I As Integer
'Définit la dernière ligne non vide dns la colonne A
DerLigne = Range("A65536").End(xlUp).Row
Cible = FreeFile
'ouvre le script
chemin = ThisWorkbook.Path
Open chemin & "\Script_test.scr" For Append As #Cible
'------Effacer le bloc note------
'copie les ref du plan
Resultat = "-CALQUE CH 0"
Print #Cible, Resultat
Resultat = Cells(1, 10)
Print #Cible, Resultat
Resultat = Cells(2, 10)
Print #Cible, Resultat
Resultat = Cells(3, 10)
Print #Cible, Resultat
Resultat = Cells(4, 10)
Print #Cible, Resultat
'defini la boucle
For I = 7 To DerLigne + 1
If I = 7 Then
'Script le coin A
Resultat = "-CALQUE CH A"
Print #Cible, Resultat
ElseIf I > 7 Then
'Compare les coins
Rep_1 = Cells(I, 1)
Rep_2 = Cells(I - 2, 1)
End If
If Rep_1 = Rep_2 Then
ElseIf Rep_1 <> Rep_2 And Rep_1 <> "" And Rep_2 <> "" Then
'Script le coin en cours
Resultat = "-CALQUE CH " & Cells(I, 1).Value
Print #Cible, Resultat
Print #Cible, Chr(10)
End If
'Copie le script du cercle et du texte
Resultat = Cells(I, 10).Value
Print #Cible, Resultat
Next I
Close #Cible
End Sub |
Partager