Sub Database()
Application.ScreenUpdating = False
Dim i, j, k, l As Integer
Dim Jour, Tech, Projet, Lieu, Dispo As String
Dim tablo As Variant ' definition du variable
k = 3
For j = 3 To 5
For i = 3 To 12
If Not Cells(j, i) Is Nothing Then
Sheets("Planning").Select
Jour = Cells(2, i).Value
Tech = Cells(j, 2).Value
Projet = Cells(j, i).Value
Sheets("Database").Select
Cells(k, 2).Value = Jour
Cells(k, 3).Value = Tech
Projet = Replace(Projet, Chr(10), "!") ' remplacement du caracter saut de ligne par un !
tablo = Split(Projet, "!") ' deconcatenation de la chaine en fonction des !
For l = LBound(tablo) To UBound(tablo) ' selon le nombre de données : 0, 1 ou 2
Cells(k, 4 + l).Value = tablo(l) ' mise en place des données
Next l
If l = 3 Then Cells(k, 6) = "!" ' si l = 3 alors il y a 3 données on met le !
k = k + 1
End If
Next i
Next j
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub