Hier noch der Code....
23.08.2012 08:55:56
Marc
Private Sub cmb17_Click()
MsgBox "jo"
End Sub
Private Sub CommandButton_Click()
MsgBox "jo"
End Sub
Dim newButton As Control
Private Sub UserForm_Initialize()
Dim cButton As MSForms.CommandButton
Set sh = Sheets("Tabelle1")
lz = sh.Cells(Rows.Count, 1).End(xlUp).End(xlUp).Row
Links = 10
Breite = 160
For i = 1 To 9
Set cButton = Me.Controls.Add("Forms.commandButton.1", "newButton")
With cButton
.Left = Links
.Width = Breite
.Height = 60
.Top = 10 * i + .Height * (i - 1)
.Caption = sh.Cells(lz, 1) & vbCrLf & sh.Cells(lz, 2) & vbCrLf & sh.Cells(lz, 3)
.Name = "cmb_" & lz
.Caption = .Name
End With
lz = lz + 1
Set cButton = Me.Controls.Add("Forms.commandButton.1", "newButton")
With cButton
.Left = 2 * Links + Breite
.Width = 160
.Height = 60
.Top = 10 * i + .Height * (i - 1)
.Caption = sh.Cells(lz, 1) & vbCrLf & sh.Cells(lz, 2) & vbCrLf & sh.Cells(lz, 3)
.Name = "cmb_" & lz
.Caption = .Name
End With
lz = lz + 1
If sh.Cells(lz, 1) = "" Then Exit For
Next i
Me.Height = cButton.Height + cButton.Top + 35
Me.Width = 3 * Links + 2 * Breite
Set cButton = Nothing
End Sub