Incompatibilté de type

L

Luc

Guest
Bonsoir le forum,

Dans mon code j'ai un 'Incompatibilité de type' ?

Voici le code en question :

Private Sub ComboBox3_Change()
Dim tabtemp As Variant
Dim N As Integer
Dim O As Variant
With Worksheets('Inventaire')
O = .Range('a15000').End(xlUp).Row
tabtemp = .Range('A2:k' & O).Value
End With


For O = 1 To UBound(tabtemp, 1)
If tabtemp(O, 1) = ComboBox1 And tablo(O, 2) = CStr(ComboBox2) And tablo(O, 3) = CStr(ComboBox3) Then
For N = 1 To 8
If tablo(N + 3) <> '' Then
Controls('ListBox' & N).AddItem tablo(N + 3)
End If
Next N
End If
Next O

Quelqu'un pourrait m'aider ?

Merci
 

ZZR09

XLDnaute Occasionnel
Bonjour Luc,

Essayes ça :
Code:
Private Sub ComboBox3_Change() 
Dim tabtemp As Variant 
Dim O, N As Integer 

With Worksheets('Inventaire') 
tabtemp = .Range('A2:k' & Range('a15000').End(xlUp).Row ).Value 
End With 


For O = 1 To UBound(tabtemp, 1) 
If tabtemp(O, 1) = ComboBox1 And tablo(O, 2) = CStr(ComboBox2) _ And tablo(O, 3) = CStr(ComboBox3) Then 
For N = 1 To 8 
If tablo(N + 3) <> '' Then 
Controls('ListBox' & N).AddItem tablo(N + 3) 
End If 
Next N 
End If 
Next O

Je n'ai pas pris le temps d'essayer mais il me semble que ton incompatibilité de type pourrait provenir du 'O' que tu utilisais de deux façons différentes.

Je vais tester et je reviens !
A+

Message édité par: zzr09, à: 23/10/2005 07:59
 

ZZR09

XLDnaute Occasionnel
Re,

Après quelques essais, voici quelque chose qui devrait passer :
Code:
Dim tabtemp As Variant
Dim O, N As Integer

tabtemp = Sheets(2).Range('A2:K' & Range('a15000').End(xlUp).Row).Value

For O = 1 To UBound(tabtemp, 1)
If tabtemp(O, 1) = CStr(Me.ComboBox1.Value) And tabtemp(O, 2) = CStr(Me.ComboBox2.Value) _
And tabtemp(O, 3) = CStr(Me.ComboBox3.Value) Then

    For N = 1 To 8
        If tabtemp(O, N + 3) <> '' Then
            Controls('ListBox' & N).AddItem tabtemp(O, N + 3)
        End If
    Next N
End If
Next O

A+
 

Statistiques des forums

Discussions
312 330
Messages
2 087 341
Membres
103 524
dernier inscrit
Smile1813