combobox

dede

XLDnaute Junior
bonjour a tous je reviens vers vous aujourd hui car j ai creer un vba qui marche sur une feuille et je veux la meme sur un autre feuille et la pas moyen la base est enorme 539531 ligne et les combobox ne m affiche que les 2 premieres si quelqu un peu m aider
Dim i As Byte

Private Sub ComboBox1_Change()

End Sub

Private Sub CommandButton1_Click()
For i = 1 To 7: Controls("Textbox" & i) = "": Next (c est la que ca merde)
With Sheets("BASE")
For i = 2 To .Range("A539531").End(xlUp).Row
If .Range("A" & i) = ComboBox1 And .Range("B" & i) = ComboBox2 Then
TextBox1 = .Range("E" & i)
TextBox2 = .Range("I" & i)
TextBox3 = .Range("F" & i)
TextBox4 = .Range("G" & i)

End If
Next i
End With
If TextBox1 = "" Then MsgBox "pas trouve de reference correspondant a la recherche"
End Sub



Private Sub UserForm_Initialize()
With Sheets("BASE"): ComboBox1.List = Range(.[A2], .[A539531].End(xlUp)).Value: End With
With Sheets("BASE"): ComboBox2.List = Range(.[B2], .[B539531].End(xlUp)).Value: End With
End Sub
 

Pierrot93

XLDnaute Barbatruc
Re : combobox

Bonjour,

Code:
With Sheets("BASE"): ComboBox1.List = .Range(.[A2], .[A539531].End(xlUp)).Value: End With
With Sheets("BASE"): ComboBox2.List = .Range(.[B2], .[B539531].End(xlUp)).Value: End With

A priori, manque un point devant les "range"...

bonne journée
@+
 

dede

XLDnaute Junior
Re : combobox

voila le cobe que j ai copier qui marche bien que j ai voulu readapter pour ma feuille BASE compprenant 6 colonnes fabricant ref fabricant designation pAht sous famille unite et 539531 ligne mais trouve pas a reflechir
 

dede

XLDnaute Junior
Re : combobox

pour etre plus simple dans ine feuille base 6 colonne fabricant/ref fabricant/designation/pbht/unite/sous famille et 539531 ligne je voudrai combobox1 choix fabricant combobox2 choix ref fabricant cela me donne automatique textbox1 designation textbox2 pbht textbox3 unite textobox4 sous famille voila le code fait mais marche pas
Dim i As Byte

Private Sub ComboBox1_Change()

End Sub

Private Sub CommandButton1_Click()
For i = 1 To 7: Controls("Textbox" & i) = "": Next i
With Sheets("BASE")
For i = 2 To .Range("A539531").End(xlUp).Row
If .Range("A" & i) = ComboBox1 And .Range("B" & i) = ComboBox2 Then
TextBox1 = .Range("c" & i)
TextBox2 = .Range("d" & i)
TextBox3 = .Range("e" & i)
TextBox4 = .Range("f" & i)

End If
Next i
End With
If TextBox1 = "" Then MsgBox "pas trouve de reference correspondant a la recherche"
End Sub



Private Sub UserForm_Initialize()
With Sheets("BASE"): ComboBox1.List = .Range(.[A2], .[A539531].End(xlUp)).Value: End With
With Sheets("BASE"): ComboBox2.List = .Range(.[B2], .[B539531].End(xlUp)).Value: End With
End Sub
 

Pierrot93

XLDnaute Barbatruc
Re : combobox

Re,

mets peut être un tout petit fichier en pièce jointe, car là en l'état nous riquons de tourner en rond longtemps...

quand tu mets un code sur le forum, utilise les balises # dans le mode avancé, et n'hésite pas à indenter ton code, bien meilleure lisibilité....
 

dede

XLDnaute Junior
Re : combobox

Voila un fichier joint pour suivre le fil pour le probleme des combobox quand la base a peut de ligne ca marche mais moi j ai une base a 539531 lignes d autre par le formule marche pour le bouton rechercher mais pas pour le bouton 4 un fois les combobox rempli les repons dans les textobox ne saffiche pas donc 2 problemes un peu d aide SVP selon dispo mais pourquoi
 

Pièces jointes

  • travail01 (Enregistré automatiquement).xlsm
    49.8 KB · Affichages: 110

Discussions similaires

Réponses
6
Affichages
248
Réponses
11
Affichages
297