bonjour,
J'avais en effet un peu perdu de vue ce détail !
Je dois pas être loin du compte maintenant.
Option Explicit
Sub galopin()
Dim i&, ii&, k&, kk&, x%
Application.ScreenUpdating = False
ii = [A1].CurrentRegion.Rows.Count
For i = ii To 3 Step -1
If Cells(i, 2).Value = Cells(i - 1, 2).Value Then
MsgBox "Données incohérentes !"
End
End If
Next
For i = ii To 3 Step -1
k = (Cells(i, 2).Value - Cells(i - 1, 2).Value) * 24
x = IIf(k < 0, 1, 0)
k = (Cells(i, 2).Value - Cells(i - 1, 2).Value + x) * 24
If k > 1 Then
For kk = 1 To k - 1
Rows(i).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(i, 2).Value = Cells(i - 1, 2).Value: Cells(i, 3).Value = Cells(i - 1, 3).Value
Next
End If
Next
End Sub
Sub galopin2()
Dim i&, ii&, k%, kk%, x%
Application.ScreenUpdating = False
ii = [A1].CurrentRegion.Rows.Count
For i = ii To 3 Step -1
If Cells(i, 2).Value = Cells(i - 1, 2).Value Then
MsgBox "Données incohérentes !"
End
End If
Next
For i = ii To 3 Step -1
k = CInt((Cells(i, 2).Value - Cells(i - 1, 2).Value) * 1440)
x = IIf(k > 0, 0, 1)
k = CInt((Cells(i, 2).Value - Cells(i - 1, 2).Value + x) * 1440)
If k > 10 Then
For kk = 10 To k - 10 Step 10
Rows(i).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(i, 2).Value = Cells(i - 1, 2).Value
Cells(i, 3).Value = Cells(i - 1, 3).Value
Cells(i, 4).Value = Cells(i - 1, 4).Value
Next
End If
Next
End Sub
A+