Problème de sélection fonction .cells ... help please (VBA Excel)

Jesusdenazarrete Messages postés 102 Date d'inscription jeudi 22 juillet 2010 Statut Membre Dernière intervention 12 juin 2012 - 14 mars 2008 à 11:51
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 - 14 mars 2008 à 12:14
Bonjour a tous

J'ai un problème pour copier la ligne qui contient la valeur CCherch, j'ai mis la ligne qui contient la faute en rouge
Je suis ouvert a toute propositions... Je dois dire avant toute chose que vligne est un long et qu'il possède la valeur 17
Je pense aussi avoir un problème à la ligne cells etc...(je l'ai mise en rouge aussi)

Merci d'avance

Public Sub Bcherch_Click()


Dim vtrouve As Range


    With worksheets("Facturation")
 
        .Activate
            Set vtrouve = .Range(.Cells(1, 1), .Cells.SpecialCells(xlCellTypeLastCell)).Find(What:=Ccherch.Value)
                .Cells(vtrouve.Row, vtrouve.Column).EntireRow.Copy
    End With
        If Nothing Is vtrouve Then
            MsgBox "Non trouvé!"
            worksheets("Recherche").Activate
        Else
        If Ccherch.Value = "" Then
            MsgBox "Champ Vide!"
            worksheets("Recherche").Activate
        Else
        With worksheets("recherche")
            .Activate
            .Cells(vligne, 1).Select
            ActiveSheet.Paste
        End With
            vligne = vligne + 1
        End If
        End If
       
End Sub
-----------------------------------------------------------------------
Merci d'avance a tous ceux qui pouront m'aider...

1 réponse

Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
14 mars 2008 à 12:14
ta ligne
.Cells(vtrouve.Row, vtrouve.Column).EntireRow.Copy

N'est valable que si un résultat a été trouvé.
place la donc au dessus de ton
With worksheets("recherche")

tu peux même faire:
vTrouve.EntireRow.Copy( worksheets("recherche").Cells(vligne,1) )

Renfield
Admin CodeS-SourceS- MVP Visual Basic
0
Rejoignez-nous