AW: Userform Problem
12.10.2005 23:23:34
Juergen
Private Sub CommandButton1_Click()
Dim c As Control, s As Byte, campi As Integer, campi2 As Integer
campi = TextBox2000.Value
If campi > 20 Then campi2 = 20
For s = 1 To campi2
Set c = Me.Controls.Add("Forms.label.1", "T" & s, True)
With c
.Height = 15.75
.Top = 15 * s
.Left = 200
.Caption = s
End With
Next
Dim b As Control, t As Byte
For t = 1 To campi2
Set b = Me.Controls.Add("Forms.TextBox.1", "T" & t, True)
With b
.Height = 15.75
.Top = 15 * t
.Left = 210
.Text = ActiveCell.Offset(0, t)
End With
Next
If campi < 20 Then GoTo 99
campi2 = campi - 20
For s = 1 To campi2
Set c = Me.Controls.Add("Forms.label.1", "T" & s, True)
With c
.Height = 15.75
.Top = 15 * s
.Left = 300
.Caption = s + 20
End With
Next
For t = 1 To campi2
Set b = Me.Controls.Add("Forms.TextBox.1", "T" & t, True)
With b
.Height = 15.75
.Top = 15 * t
.Left = 310
.Text = ActiveCell.Offset(0, t)
End With
Next
99
End Sub