PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2025 → Excel Ole passage de paramètre dans commande >>Find
Excel Ole passage de paramètre dans commande >>Find
Débuté par guest, 17 aoû. 2006 18:41 - 2 réponses
Posté le 17 août 2006 - 18:41
Je souhaiterais faire une recherche de type cellule entière dans une colonne excel, la commande VBA est :
Columns("B:B").Select
Selection.Find(What:="USA", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

J'essaie de la traduire en Windev mais ne marche pas, j'obtiens une erreur "Erreur, Type Incorrect pour le paramètre 4)
xl>>Range("A:A")>>Find("USA"): fonctionne
xl>>Range("A:A")>>Find("USA","LookAt:=xlWhole") : ne fonctionne pas
J'ai essayé aussi
xl>>Range("A:A")>>Find("USA","LookAt:=1") : ne fonctionne pas
xl>>Range("A:A")>>Find("USA","","","1") : ne fonctionne pas

merci de m'expliquer comment on passe ce paramètre
Posté le 17 août 2006 - 19:07
J'ai trouvé la réponse dans un forum foxpro !
oexcel>>Range("A1:H250")>>Find(" Q1").Select && simple default search
oexcel>>Range("A1:H250")>>Find("Q1",oexcel>>ActiveCell ,-4123,1).Select


oExcel is the object you created.
Range("A1:H250") specifies that we're searching columns A to H (inclusive) and rows 1-250.
"Q1" is what we're searching for
oexcel.ActiveCell is where to start searching
-4123 is the constant in for xlFormulas. I theorize that this means 'if there is a formula, search its code rather than its output.'
1 is the constant in for xlWhole, meaning match against all the text in the cell. You could swap in 2 to get partial matches.
Posté le 02 mars 2009 - 12:32
Un code adapté qui renvoie les coordonnées retour de la chaine trouvée passée en recherche

:m_xExcel>>UsedRange>>Find("$DATAS", :m_xExcel>>ActiveCell, -4123, 1)>>Select
sCoordsRetour = :m_xExcel>>ActiveCell>>Address()

Merci pour ce petit bout de code