غير الكود السابق بهذا الكود
Private Sub UserForm_Initialize()
Dim RR As Control
For i = 1 To 10
Set RR = Me.Controls.Add("forms.TextBox.1", "TextBox" & i, True)
With RR
.Left = 80: .Top = 10 + (i * 20): .Width = 60: .Height = 15:
.Text = Cells(2, i)
End With
Next
Dim LL As Control
For s = 1 To 10
Set LL = Me.Controls.Add("forms.Label.1", "Label" & s, True)
With LL
.Left = 10: .Top = 10 + (s * 20): .Width = 60: .Height = 15: .Visible = True: .BackColor = &H80FF80 ' &H80000008
.Caption = Cells(1, s)
End With
With Me
.ScrollBars = fmScrollBarsVertical
.ScrollHeight = .InsideHeight * s / 5
.ScrollWidth = .InsideWidth * 9
End With
Next s
End Sub