XL 2016 Tableau de 14 colonnes

djpsy4trik

XLDnaute Nouveau
Bonjour,

depuis quelques temps j'essai de trouver un codage pas trop compliqué pour pouvoir avec mon tableau de 14 colonnes dans mon vba avec un affichage pas trop lent.

Après moult recherche j'ai trouvé quelque chose qui ne fonctionne pas trop mal (ComboListBox12) sauf que je n'ai que ma première colonne quand je l'ai adapté au mien.



merci à tous
 

Pièces jointes

  • ComboListBox12 (3).xls
    82 KB · Affichages: 10

patricktoulon

XLDnaute Barbatruc
bonjour deja je reduit ton userform a la taille de la plage

VB:
Private Sub UserForm_Initialize()
  Set f = Sheets("BD")
  Set d = CreateObject("Scripting.Dictionary")
  Set bd = f.Range("A2:M" & f.[M65000].End(xlUp).Row)
  For i = 1 To bd.Rows.Count
    If bd.Cells(i, 1) <> "" Then d(bd.Cells(i, 1).Value) = ""
  Next i
   Me.ListBox1.ColumnCount = bd.Columns.Count + 1
  Me.ListBox1.Width = bd.Width + bd.Cells(bd.Cells.Count).Width - 25
  temp = d.keys
  Tri temp, LBound(temp), UBound(temp)
  Me.ComboBox1.List = temp
  Me.ListBox1.List = bd.Value
   For k = 1 To 13
  With Me("label" & k)
  .Caption = f.Cells(1, k):
  .Width = f.Cells(1, k).Width
  .Left = f.Cells(1, k).Left + ListBox1.Left
 
  colwidth = colwidth & IIf(k > 1, ";", "") & f.Cells(1, k).Width
 
 
  End With
   ListBox1.ColumnWidths = colwidth
  Next k

End Sub
 

djpsy4trik

XLDnaute Nouveau
J'ai fait comme tu m'a dit:

VB:
Sub controle()
Dim nblignes As Integer
Sheets("Controle").Select
Range("A1").Select

Set f = Sheets("Controle")
  Set d = CreateObject("Scripting.Dictionary")
  Set bd = f.Range("A2:N" & f.[N65000].End(xlUp).Row)
  For I = 1 To bd.Rows.Count
    If bd.Cells(I, 1) <> "" Then d(bd.Cells(I, 1).Value) = ""
  Next I
    Me.L_controle.ColumnCount = bd.Columns.Count + 1
  Me.L_controle.Width = bd.Width + bd.Cells(bd.Cells.Count).Width - 25
  temp = d.keys
  Tri temp, LBound(temp), UBound(temp)
  Me.ComboBox1.List = temp
  Me.L_controle.List = bd.Value

 For k = 1 To 13
  With Me("label" & k)
  .Caption = f.Cells(1, k):
  .Width = f.Cells(1, k).Width
  .Left = f.Cells(1, k).Left + L_controle.Left
 
  colwidth = colwidth & IIf(k > 1, ";", "") & f.Cells(1, k).Width
 
 
  End With
   L_controle.ColumnWidths = colwidth
  Next k



End Sub



il me dit maintenant "erreur d'exécution '2147024809(80070057) "
 

Discussions similaires

Statistiques des forums

Discussions
311 725
Messages
2 081 943
Membres
101 849
dernier inscrit
florentMIG