Sub
generate_Buttons()
Set
Sheet = ThisWorkbook.Worksheets(
"Sheet3"
)
Dim
column
As
Variant
Dim
row
As
Variant
column = 1
row = 2
Dim
NewButton
As
Object
Dim
buttonHigh
As
Integer
Dim
buttonWidth
As
Integer
Dim
actualX
As
Integer
Dim
actualY
As
Integer
buttonStart = 10
buttonSpacing = 10
buttonHigh = 20
buttonWidth = 150
actualX = 150
actualY = buttonStart
lastRow = Sheet.Cells.SpecialCells(xlCellTypeLastCell).row
If
lastRow = Emtpy
Then
Else
For
actualRow = row
To
lastRow
Set
NewButton = Sheet.Buttons.Add(actualX, actualY, buttonWidth, buttonHigh)
NewButton.Caption = Sheet.Cells(actualRow, column).Value
Dim
MethodeXY
As
Variant
MethodeXY = Sheet.Cells(actualRow, column).Value
NewButton.Font.Bold =
True
NewButton.OnAction = Sheets(MethodeXY).
Select
actualY = actualY + buttonHigh + buttonSpacing
Next
End
If
End
Sub