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
| '[PARCOURIR LE TABLEAU DE DONNEES]
With Range(nomPlage)
'Attention, avec un "tableau", il faut commencer à 1 et pas à 2 car les en-têtes ne sont pas comptées dans les lignes
For i = 1 To .Rows.count
numVoyage = CStr(.Cells(i, "A").Value)
nomPoint = CStr(.Cells(i, "B").Value)
heurePoint = CStr(.Cells(i, "C").Value)
nomHoraire = CStr(.Cells(i, "I").Value)
idDesserte = CStr(.Cells(i, "M").Value)
jourVoyage = CStr(.Cells(i, "L").Value)
codeVoyage = numVoyage & "|" & idDesserte
'[CONTROLE A CHAQUE LIGNE]
If manchette1 = "" And manchette2 = "" Then
manchette1 = CStr(.Cells(i, "N").Value)
manchette2 = CStr(.Cells(i, "O").Value)
End If
'[PRESENCE POINT VIDE]
If presencePointVide = False Then
If nomPoint = "" Then
logPointVide = "La ligne " & i & " est sans lieu"
presencePointVide = True
End If
End If
'[CREATION HORAIRE]
If Not dictHoraires.Exists(nomHoraire) Then
nouvelHoraire = nomHoraire 'l'id de l'horaire est unique et suffit à l'identification d'un nouvel objet cHoraire
Set nouvelHoraire = New cHoraire
Set dictHoraires(nomHoraire) = nouvelHoraire
End If
'[CREATION VOYAGE]
If dictHoraires(nomHoraire).tripIsInVsc(codeVoyage & "_" & nomHoraire) = False Then
nouveauVoyage = codeVoyage & "_" & nomHoraire 'Pour identifier un voyage, il est préférable de lui créer un code unique sur la base de sa desserte commerciale
Set nouveauVoyage = New cVoy
nouveauVoyage.numero = numVoyage
nouveauVoyage.direction = CStr(.Cells(i, "D").Value)
dictHoraires(nomHoraire).addTripToVSC(codeVoyage) = nouveauVoyage
End If
Dim test As New cVoy
'[TEST]
test = dictHoraires(nomHoraire).getTrip(codeVoyage)
Next i
End With |
Partager