Private Sub CommandButton1_Click()
j = 1
While Workbooks("coloration.xls").Sheets("Feuil1").Cells(2, j).Value <> " "
j = j + 1
Wend
MsgBox j
End Sub
Private Sub UserForm_initialize()
Call alphatest(1)
ListBox1.AddItem "0ième"
ListBox1.AddItem "premier"
ListBox1.AddItem "deuxieme"
ListBox1.AddItem "troisieme"
ListBox1.AddItem "quatrième"
ListBox1.AddItem "5ième"
End Sub
Sub exemple_click()
ActiveSheet.Select
Cells(2, 1).Select
With Selection
.Value = ListBox1.List(0)
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
End With
For j = 1 To (ListBox1.ListCount - 1)
Cells(1, 2 * j).Select
With Selection
.Value = ListBox1.List(j)
'.Borders(xlEdgeBottom).Weight = xlMedium
'.Borders(xlEdgeRight).Weight = xlMedium
.Columns.AutoFit
End With
Cells(2, 2 * j).Select
With Selection
.Value = Cells(1, 2 * j) & " test"
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
.Columns.AutoFit
End With
Cells(2, (2 * j) + 1).Select
With Selection
.Value = Cells(1, 2 * j) & " valeur"
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
.Columns.AutoFit
End With
'Cells(1, 2 * j).Value = ListBox1.List(j)
' Cells(2, 2 * j).Value = Cells(1, 2 * j) & " test"
'Cells(2, (2 * j) + 1).Value = Cells(1, 2 * j) & " valeur"
Next j
End Sub