Private Sub CommandButton1_Click()
Dim ligne As Long
Dim Tot As Range
ligne = .Range("B" & .Rows.Count).End(xlUp).Row
Set Tot = .Range("b1:b" & ligne).Find.UserForm.ListBox1.Text
.Range("A" & Tot.Row + 7) = TextBox1.Text
End Sub
Il doit me permettre de rechercher un texte dans mon tableau ( identique à celui selectionner dans ma listBox1)
Et ensuite inserer dans la cellule A , 7 lignes plus bas le texte de la TextBox1. Or cela plante au niveau de .Rows.Count.
Quelqu'un pourrait il m'aider
Merci par avance
Re : VBA _ Soucis sur fonction recherche et insertion dans tableau
Bonjour Toushouss, bonjour le forum
il te manque un With...End With :
Code:
Private Sub CommandButton1_Click()
Dim ligne As Long
Dim Tot As Range
With Sheets(ton_onglet)
ligne = .Range("B" & .Rows.Count).End(xlUp).Row
Set Tot = .Range("b1:b" & ligne).Find.UserForm.ListBox1.Text
.Range("A" & Tot.Row + 7) = TextBox1.Text
End With
End Sub
Re : VBA _ Soucis sur fonction recherche et insertion dans tableau
Merci Robert j' ai résolu mo probleme
Code:
With Sheets("EDF").Range("B2:B2000")
Set Tot = .Find(UserForm2.ListBox1.Text)
If Range("A" & Tot.Row + 7) = "" Then
Range("A" & Tot.Row + 7) = UserForm2.TextBox1.Text[\Code]