Public WithEvents bouton As msforms.Label
Public WithEvents Box As msforms.Frame
Dim cls(1 To 150) As New UserForm1
Private Sub bouton_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ControlMove bouton, Button, X, Y
End Sub
Private Sub Box_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ControlMove Box, Button, X, Y
End Sub
Public Function ControlMove(ByVal ctrl As msforms.Control, ByVal Button As Integer, ByVal X As Single, ByVal Y As Single)
    Static EcX#: Static EcY#: Static tbl(1 To 3) As Object
    ctrl.ZOrder 0
    If Button = 1 Then
        If EcX = 0 Then
            EcX = X: EcY = Y
            For Each ctrlx In ctrl.Parent.Controls
                If Int(ctrlx.Left) = Int(ctrl.Left) Then q = q + 1: Set tbl(q) = ctrlx: ctrlx.ZOrder 0
            Next
        End If
        For i = 1 To 3
            If Not tbl(i) Is Nothing Then tbl(i).Move Int(ctrl.Left + (X - EcX))    ', ctrl.Top + (Y - EcY)
        Next
    Else
        If EcX > 0 Or EcY > 0 Then repositionne ctrl, ctrl.Parent
        EcX = 0: EcY = 0
    End If
End Function
Public Function repositionne(ctrl As Object, group As Object)
    ReDim tbl(1 To group.Controls.Count, 1 To 3)
     Dim a&, q As Boolean
    'creation du tableau
    For Each ctrl In group.Controls
        i = i + 1
        tbl(i, 1) = ctrl.Name: tbl(i, 2) = Int(ctrl.Left)
    Next
    ' tri dans l'ordre par le left
    For i = 1 To UBound(tbl) - 1
        For a = i + 1 To UBound(tbl)
            If tbl(a, 2) < tbl(i, 2) Then
                n = tbl(i, 1): p = tbl(i, 2)
                tbl(i, 1) = tbl(a, 1): tbl(i, 2) = tbl(a, 2)
                tbl(a, 1) = n: tbl(a, 2) = p
            End If
        Next
    Next
   Cells(1, 1).Resize(UBound(tbl), 3) = tbl
   a = 5
    For i = 1 To UBound(tbl)
        tbl(i, 3) = a
        If i > 1 Then
            If tbl(i, 2) <> tbl(i - 1, 2) Then
                a = a + 5 + group.Controls(tbl(i - 1, 1)).Width
                tbl(i, 3) = a
            Else
                tbl(i, 3) = a
            End If
        End If
    Next
    For i = 1 To UBound(tbl)
        group.Controls(tbl(i, 1)).Left = tbl(i, 3)
    Next
    Cells(1, 1).Resize(UBound(tbl), 3) = tbl
End Function
Private Sub UserForm_Activate()
    For Each ctrl In G1.Controls
        Select Case ctrl.Tag
        Case "litlebutton", "bigbutton"
            i = i + 1
            X = Array(30, 16)(Abs(ctrl.Tag = "litlebutton"))
            Set cls(i).bouton = ctrl
        Case "box"
            i = i + 1
            Set cls(i).Box = ctrl
        End Select
    Next
End Sub