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
| Sub test01()
Dim Feuil_D As Worksheet
Dim Feuil_R As Worksheet
Dim Donnee As String
Dim Initial As String
Dim Nbrs, Nbrs_PE, Nbrs_PD As String
Dim Large_T, Large_Tp As String
Dim cpt As Long
Dim nerr As Long
Dim Lig_Lec As Long
Dim Idx_Col_E, Idx_Lig_E As Long
On Error GoTo lblErr
Application.ScreenUpdating = False
Set Feuil_D = ThisWorkbook.Worksheets("Donnée")
Set Feuil_R = ThisWorkbook.Worksheets("graphe A")
Lig_Lec = 1
cpt = 0
nerr = 0
Col = 2
Idx_Lig_E = 2
Idx_Col_E = 2
Large_T = 10: Large_Tp = Large_T + 1
'Boucle traitement des données
While Feuil_D.Cells(Lig_Lec, 1) > ""
'Exctration de la donnée de la ligne "
Donnee = Feuil_D.Cells(Lig_Lec, 1) 'Donnee
Initial = Mid(Donnee, 1, 1) 'Initial
Nbrs = Mid(Donnee, 2, Len(Donnee)) 'Nbrs
'Test si "Donnée non numérique en ligne "
If Not IsNumeric(Nbrs) Then
'Debug.Print "Donnée non numérique en ligne " & Lig_Lec
MsgBox "Valeur non numérique en ligne " & Lig_Lec, vbExclamation, "Erreur"
Exit Sub
End If
Nbrs_PE = Int(Nbrs / Large_T)
Nbrs_PD = Nbrs - (Nbrs_PE * Large_T)
Idx_Lig_E = Nbrs_PE + 2
Idx_Col_E = Nbrs_PD + 2
Feuil_R.Cells(Idx_Lig_E, Idx_Col_E) = Initial & Nbrs
Lig_Lec = Lig_Lec + 1
Wend
GoTo lblFin
lblErr:
MsgBox Err.Description
lblFin:
Set Feuil_R = Nothing
Set Feuil_D = Nothing
Application.ScreenUpdating = True
End Sub |
Partager