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
| Sub TransfDonn()
Dim i As Long, Nom As String, Adresse As String, Gerant As String, LigDest As Long
LigDest = 2
Nom = ""
Adresse = ""
Gerant = ""
With Sheets("Feuil1")
For i = 2 To .Cells(Rows.Count, 3).End(xlUp).Row
If .Cells(i, 3).Value <> "" Then
Gerant = .Cells(i, 3).Value
Sheets("Feuil2").Cells(LigDest, 1).Value = Nom
Sheets("Feuil2").Cells(LigDest, 2).Value = Adresse
Sheets("Feuil2").Cells(LigDest, 8).Value = Gerant
Nom = ""
Adresse = ""
Gerant = ""
LigDest = LigDest + 1
ElseIf .Cells(i, 1).Value <> "" Then
If Nom <> "" Then
Adresse = .Cells(i, 1).Value
Else
Nom = .Cells(i, 1).Value
End If
End If
Next i
End With
End Sub |
Partager