Option Explicit
Sub LignePlante()
If ActiveSheet.Name <> "BDD_FLEURS" Then Exit Sub
Dim cel As Range, plante$, lig&, b As Byte, i As Byte
plante = [P9]: If plante = "" Then Exit Sub
Application.ScreenUpdating = 0
Set cel = Columns(6).Find(plante, , -4163, 1, 1)
If Not cel Is Nothing Then
lig = cel.Row: b = 1 'plante trouvée ; b = 1
Else 'plante non trouvée ; b reste à 0
lig = ActiveSheet.ListObjects("T_Datas").ListRows.Count + 27
End If
With Cells(lig, 6)
If [P7] <> "" Then .Offset(, 1) = [P7] 'Fournisseur
If [P11] <> "" Then .Offset(, 7) = [P11] 'Catégorie
If [P13] <> "" Then .Offset(, 12) = [P13] 'Couleur Fleurs
If [P15] <> "" Then .Offset(, 11) = [P15] 'Couleurs Feuilles
If [P17] <> "" Then .Offset(, 14) = [P17] 'Hauteur
If [P19] <> "" Then .Offset(, 15) = [P19] 'Largeur
If [P21] <> "" Then .Offset(, 29) = [P21] 'Densité
If [P23] <> "" Then .Offset(, 16) = [P23] 'Port
If [W7] <> "" Then .Offset(, 10) = [W7] 'Mellifère
If [W9] <> "" Then .Offset(, 13) = [W9] 'Inflorescence
If [W11] <> "" Then .Offset(, 9) = [W11] 'Attrait de la plante
If [W13] <> "" Then .Offset(, 8) = [W13] 'Contenant
If [W18] <> "" Then .Offset(, 2) = [W18] 'Marché
For i = 0 To 11 'Mois J à D
If [W16].Offset(, i) <> "" Then .Offset(, 17 + i) = [W16].Offset(, i)
Next i
Application.Goto .Offset(, -1), True: Application.ScreenUpdating = -1
If b = 0 Then
.Value = plante 'Plante
MsgBox "Nouvelle plante, ajoutée en fin de liste.", 64
Else
MsgBox "Plante modifiée en ligne " & lig & ".", 48
End If
End With
End Sub