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
| Function Previous(ByRef pLigne As Variant) As Variant 'pLigne fait référence au ligne de la feuille précédente
Dim comm As Variant, ligne As Variant, i As Integer, var As Variant, trouver As Boolean, InRange As Range, Arg As Range
comm = ActiveSheet.Previous.Cells(Rows.Count, 1).End(xlUp).Row
For ligne = 2 To comm
'MsgBox (ligne)
For i = ActiveSheet.Previous.Index + 1 To Worksheets.Count
'MsgBox (i)
trouver = False
If ActiveSheet.Cells(pLigne, i).Value = ActiveSheet.Previous.Cells(ligne, i).Value Then
Previous = ActiveSheet.Previous.Cells(ligne, 1).Value
Else
Exit For
End If
Next i
Next ligne
End Function
Sub test()
Dim comm As Variant, ligne As Variant, bln As Boolean, isheet As Variant, x As Variant
Dim newcomm As Variant, newligne As Variant, newbln As Boolean, newisheet As Variant
comm = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
For ligne = 2 To comm
If IsEmpty(Cells(ligne, 1)) Then
'For isheet = ActiveSheet.Index + 1 To Worksheets.Count
bln = False
ActiveSheet.Cells(ligne, 1).Value = Previous(ligne)
'MsgBox (ligne)
End If
Next ligne
End Sub |
Partager