| 12
 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
 
 | Function GetLastLine(aColumn As String) As Integer
 
' return the last line of column specified by aColumn
 
' example: LastLine = GetLastLine("A")
 
    GetLastLine = Range(aColumn & "65536").End(xlUp).Row
 
End Function
 
Sub Procédure()
Dim lastline As Long
Sheets("Feuil1").Select
lastline = GetLastLine("A")
Dim Index As Long
   For Index = 2 To lastline
           If Cells(Index, 1).Value = 2 Then
              Cells(Index, 4) = Cells(Index, 3)
              Cells(Index, 3).value=""
        ElseIf Cells(Index, 1).Value = 3 Then
              Cells(Index, 5) = Cells(Index, 3)
              Cells(Index, 3).value=""
        ElseIf Cells(Index, 1).Value = 4 Then
              Cells(Index, 6) = Cells(Index, 3)
              Cells(Index, 3).value=""
        ElseIf Cells(Index, 1).Value = 5 Then
              Cells(Index, 7) = Cells(Index, 3)
              Cells(Index, 3).value=""
        ElseIf Cells(Index, 1).Value = 6 Then
              Cells(Index, 8) = Cells(Index, 3)
              Cells(Index, 3).value=""
        ElseIf Cells(Index, 1).Value = 7 Then
              Cells(Index, 9) = Cells(Index, 3)
              Cells(Index, 3).value=""
        Else
              Cells(Index, 3) = Cells(Index, 3)
              Cells(Index, 3).value=""
          End If
    Next
 
 
 
End Sub |