XL 2010 macro de recherche

michel.dupont

XLDnaute Occasionnel
bonjour
qui peut m'aider ? ce code me retourne une erreur de compilation variable non définie...quelle correction apporter
merci et bonne journée
Michel

Sub cherche_plusieurs()
[A:C].Interior.ColorIndex = xlNone
nom = InputBox("Nom cherché?")
If nom = "" Then Exit Sub
Set c = [A:A].Find(nom, , , xlWhole)
If Not c Is Nothing Then
premier = c.Address
Do
c.Resize(, 3).Interior.ColorIndex = 4
Set c = [A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
End Sub
 

Staple1600

XLDnaute Barbatruc
Re

Et comme ceci?
VB:
Sub cherche_plusieurs()
Dim c As Range, nom
[A:C].Interior.ColorIndex = xlNone
nom = InputBox("Nom cherché?")
If nom = "" Then Exit Sub
Set c = [A:A].Find(nom, , , xlWhole)
If Not c Is Nothing Then
premier = c.Address
Do
c.Resize(, 3).Interior.ColorIndex = 4
Set c = [A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
End Sub
 

Staple1600

XLDnaute Barbatruc
Re

Et comme cela?
VB:
Sub cherche_plusieurs()
Dim c As Range, premier$, nom
[A:C].Interior.ColorIndex = xlNone
nom = InputBox("Nom cherché?")
If nom = "" Then Exit Sub
Set c = [A:A].Find(nom, , , xlWhole)
If Not c Is Nothing Then
premier = c.Address
Do
c.Resize(, 3).Interior.ColorIndex = 4
Set c = [A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
311 709
Messages
2 081 754
Membres
101 812
dernier inscrit
trufu