Dim ArrButtons() As New CommandButtonClass
Sub AddButtons(ByVal Form As Object)
Dim arr As Variant
Dim ButtonCount As Long
Dim r As Long, c As Long
Dim ButtonAdd As MSForms.CommandButton
'-----------------------------------------------------------------------------------------------------------------
' SETTINGS
' (Adjust Values As Required)
'-----------------------------------------------------------------------------------------------------------------
Const ButtonHeight As Long = 20, ButtonWidth As Long = 72
Const ButtonTopStart As Long = 6, ButtonLeft As Long = 30
Const ButtonSpace As Long = 4
'-----------------------------------------------------------------------------------------------------------------
With ThisWorkbook.Worksheets("Sheet1")
arr = .Range("A2").Resize(.Cells(.Rows.Count, 1).End(xlUp).Row - 1, 2).Value
End With
ButtonTop = ButtonTopStart
For r = 1 To UBound(arr, xlRows)
For c = 1 To UBound(arr, xlColumns)
If Len(arr(r, c)) > 0 Then
ButtonCount = ButtonCount + 1
Set ButtonAdd = Form.Controls.Add("Forms.CommandButton.1", arr(r, c))
ReDim Preserve ArrButtons(1 To ButtonCount)
Set ArrButtons(ButtonCount).CommandButtonGroup = ButtonAdd
With ButtonAdd
.Caption = arr(r, c)
.Width = ButtonWidth
.Height = ButtonHeight
.Left = IIf(c = 1, ButtonLeft, ButtonLeft + ButtonWidth + (ButtonSpace * 6))
.Top = ButtonTop
End With
End If
Set ButtonAdd = Nothing
Next c
ButtonTop = ButtonTop + ButtonHeight + ButtonSpace
Next r
End Sub