Bonjour à tous,
Je vient vers vous pour vous demander un peu d'aide.
Sur l'un de mes scripts VBA, je fait un split d'une colonne pour récuperer un horaire.
Cela marche correctement pour toutes les lignes sauf une dans laquelle l'heure est égale à 00:00:00 🙁
Le message d'erreur est le suivant:
L'indice n'appartient pas à la sélection
Et j'ai mis en gras dans cet extrait de script, la ligne sur laquelle s'arrete l'execution.
NBRLigneTOTAL = 1
While Not Cells(NBRLigneTOTAL, 4) = ""
' Effacement de la premiere ligne si c'est la ligne de titre
' Si la ligne est vide ou si pas d'horaire de fin
If Cells(NBRLigneTOTAL, 1) = "Application" Or Cells(NBRLigneTOTAL, 1) = "" Or Cells(NBRLigneTOTAL, 6) = "" Then
Rows(NBRLigneTOTAL & ":" & NBRLigneTOTAL).Select
Selection.Delete
Else
' Calcul du temps d'execution
DATE_HEURE_DEBUT = Split(Cells(NBRLigneTOTAL, 4), " ")
Cells(NBRLigneTOTAL, 5).Value = DATE_HEURE_DEBUT(1)
DATE_HEURE_FIN = Split(Cells(NBRLigneTOTAL, 6), " ")
Cells(NBRLigneTOTAL, 7).Value = DATE_HEURE_FIN(1)
Cells(NBRLigneTOTAL, 8).Value = Cells(NBRLigneTOTAL, 7) - Cells(NBRLigneTOTAL, 5)
' Si resultat négatif, on efface la ligne
If Cells(NBRLigneTOTAL, 8).Value < 0 Then
Rows(NBRLigneTOTAL & ":" & NBRLigneTOTAL).Select
Selection.Delete
Else
NBRLigneTOTAL = NBRLigneTOTAL + 1
End If
End If
Wend
Merci pour votre aide !
Christophe
Je vient vers vous pour vous demander un peu d'aide.
Sur l'un de mes scripts VBA, je fait un split d'une colonne pour récuperer un horaire.
Cela marche correctement pour toutes les lignes sauf une dans laquelle l'heure est égale à 00:00:00 🙁
Le message d'erreur est le suivant:
L'indice n'appartient pas à la sélection
Et j'ai mis en gras dans cet extrait de script, la ligne sur laquelle s'arrete l'execution.
NBRLigneTOTAL = 1
While Not Cells(NBRLigneTOTAL, 4) = ""
' Effacement de la premiere ligne si c'est la ligne de titre
' Si la ligne est vide ou si pas d'horaire de fin
If Cells(NBRLigneTOTAL, 1) = "Application" Or Cells(NBRLigneTOTAL, 1) = "" Or Cells(NBRLigneTOTAL, 6) = "" Then
Rows(NBRLigneTOTAL & ":" & NBRLigneTOTAL).Select
Selection.Delete
Else
' Calcul du temps d'execution
DATE_HEURE_DEBUT = Split(Cells(NBRLigneTOTAL, 4), " ")
Cells(NBRLigneTOTAL, 5).Value = DATE_HEURE_DEBUT(1)
DATE_HEURE_FIN = Split(Cells(NBRLigneTOTAL, 6), " ")
Cells(NBRLigneTOTAL, 7).Value = DATE_HEURE_FIN(1)
Cells(NBRLigneTOTAL, 8).Value = Cells(NBRLigneTOTAL, 7) - Cells(NBRLigneTOTAL, 5)
' Si resultat négatif, on efface la ligne
If Cells(NBRLigneTOTAL, 8).Value < 0 Then
Rows(NBRLigneTOTAL & ":" & NBRLigneTOTAL).Select
Selection.Delete
Else
NBRLigneTOTAL = NBRLigneTOTAL + 1
End If
End If
Wend
Merci pour votre aide !
Christophe