Dim Nb As Integer
Nb = Worksheets.Cells(2, 3).Value
If Nb <= 3 Then
For i = 1 To Nb
Userformx.CommandButtoni.Create
Userformx.CommandButtoni.Top = 6
Userformx.CommandButtoni.Left = 12 * i * 8
Userformx.CommandButtoni.Height = 42
Next
End If
If Nb <= 6 Then
For i = 1 To 3
Userformx.CommandButtoni.Create
Userformx.CommandButtoni.Top = 6
Userformx.CommandButtoni.Left = 12 * i * 8
Userformx.CommandButtoni.Height = 42
Next
For i = 4 To Nb - 3
Userformx.CommandButtoni.Create
Userformx.CommandButtoni.Top = 6 * i * 3
Userformx.CommandButtoni.Left = 12 * i * 8
Userformx.CommandButtoni.Height = 42
Next
End If
' Etc...