XL 2010 VBA problème selection cellule après un find

Johan

XLDnaute Occasionnel
Bonjour à tous

Je rencontre des soucis pour sélectionner la callule recherchée après mon find. Je tourne en rond depuis taleur sans trouver comment résoudre un problème à priori simple !

Quelqu'un voit-il ce qui ne pas ?

Merci

-------------------------------------------------------------------------------------

"Erreur d'éxecution 1004 : la méthode activate de la classe range a échoué"


Code:
Sub test()

Dim valSemaine
valSemaine = Feuil7.Range("P28").Value
Dim r As Range

With Feuil9.Range("B:B")

Set r = .Cells.Find(valSemaine)
    If r Is Nothing Then
        MsgBox ("Not Found")
    Else
       MsgBox (r.Address)
       r.Activate
       r.CurrentRegion.Select
       r.CurrentRegion.Copy
    End If
End With
End Sub
 

pierrejean

XLDnaute Barbatruc
A tester:

Dim valSemaine
valSemaine = Feuil7.Range("P28").Value
Dim r As Range

With Feuil9.Range("B:B")

Set r = .Cells.Find(valSemaine)
If r Is Nothing Then
MsgBox ("Not Found")
Else
MsgBox (r.Address)
'r.Activate
'r.CurrentRegion.Select
'r.CurrentRegion.Copy
r.select
End If
End With
 

pierrejean

XLDnaute Barbatruc
Re

comme ceci peut-être

Dim valSemaine
valSemaine = Feuil7.Range("P28").Value
Dim r As Range

With Feuil9
Set r = .Range("B:B").Find(valSemaine)
If r Is Nothing Then
MsgBox ("Not Found")
Else
MsgBox (r.Address)
'r.Activate
'r.CurrentRegion.Select
'r.CurrentRegion.Copy
r.select
End If
End With

Sinon poster une copie du fichier sans données confidentielles
 

Discussions similaires

Statistiques des forums

Discussions
312 113
Messages
2 085 430
Membres
102 889
dernier inscrit
monsef JABBOUR