For each --> incompatibilité de type 13 ??

Dam178

XLDnaute Nouveau
Bonjour,

Mon code est simple mais ne fonctionne pas.

Code:
Private Sub ComboBox1_Change()

Dim ste As Range

For Each ste In Sheets(2).Range("a3:a100")
If ste.Value = ComboBox1.Value Then
X = Sheets(2).Cells(ste, 1).Value
End If

Next ste

MsgBox X

End Sub

apparement trés simple, quand j'execute mon Userform, il me marque erreur: incompatibilité de type 13
Pour info: les valeurs du range("a3:a100") sont du texte.

Quelqu'un aurait-il une idée ?

Merci
 

Roland_M

XLDnaute Barbatruc
Re : For each --> incompatibilité de type 13 ??

re

voir comme ceci

Private Sub ComboBox1_Change()

Dim ste As Range, X$

For Each ste In Sheets(2).Range("a3:a100")
If ste.Value = ComboBox1.Value Then
X = Sheets(2).Cells(ste.Row, 1).Value
MsgBox X
End If
Next

End Sub
 

Statistiques des forums

Discussions
312 213
Messages
2 086 305
Membres
103 174
dernier inscrit
OBUTT