1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Private Sub ComboBox1_Change()
Label2.Visible = True: Repaint
ListView1.ListItems.Clear
For i = 1 To 4: Controls("TextBox" & (i)) = "": Next
Set SheetBase = ThisWorkbook.Sheets(ComboBox1.Value)
With ws
SheetBase.Cells.Columns.AutoFit With UserForm1.ListView1: .View = 3: .Gridlines = True: .FullRowSelect = True: .Sorted = True
With .ColumnHeaders
For i = 1 To 10 '"10
If SheetBase.Cells(1, i).Value <> "" Then
.Add , , SheetBase.Cells(1, i).Value, (SheetBase.Columns(i).ColumnWidth * 4) + 18
'"4" étant issu des tests (Voire Inches et Points), et "+ 18" un correctif de la même origine.
End If
Next i
End With
For i = 2 To SheetBase.Cells(SheetBase.Rows.Count, 1).End(xlUp).Row
.ListItems.Add , , Format(SheetBase.Cells(i, 1).Value, "00#")
For j = 1 To .ColumnHeaders.Count - 1
If SheetBase.Cells(i, j + 1).Value <> "" Then
.ListItems(.ListItems.Count).ListSubItems.Add , , SheetBase.Cells(i, j + 1).Value
Else
.ListItems(.ListItems.Count).ListSubItems.Add , , "?" 'Ceci pour une suite où Wind n'aime pas le vide!
End If
Next j
Next i
End With
End With
Label2.Visible = False
End Sub |
Partager