Incompatibilté de type

  • Initiateur de la discussion Initiateur de la discussion Luc
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

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
 
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
 
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+
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Assurez vous de marquer un message comme solution pour une meilleure transparence.

Discussions similaires

Réponses
5
Affichages
907
Réponses
2
Affichages
526
Réponses
15
Affichages
776
  • Question Question
Microsoft 365 Erreur UBound
Réponses
4
Affichages
292
Retour