make array

  • Thread starter Thread starter !..:: Enang ::..!
  • Start date Start date
E

!..:: Enang ::..!

Hi

how to make as array ?

TextBox2.Text = Cells(ActiveCell.Row, ActiveCell.Column + 11).Value
TextBox3.Text = Cells(ActiveCell.Row, ActiveCell.Column + 12).Value
TextBox4.Text = Cells(ActiveCell.Row, ActiveCell.Column + 13).Value
TextBox5.Text = Cells(ActiveCell.Row, ActiveCell.Column + 14).Value
TextBox6.Text = Cells(ActiveCell.Row, ActiveCell.Column + 15).Value
TextBox7.Text = Cells(ActiveCell.Row, ActiveCell.Column + 16).Value
TextBox8.Text = Cells(ActiveCell.Row, ActiveCell.Column + 17).Value
TextBox9.Text = Cells(ActiveCell.Row, ActiveCell.Column + 18).Value
TextBox10.Text = Cells(ActiveCell.Row, ActiveCell.Column + 19).Value
TextBox11.Text = Cells(ActiveCell.Row, ActiveCell.Column + 20).Value
TextBox12.Text = Cells(ActiveCell.Row, ActiveCell.Column + 21).Value
TextBox13.Text = Cells(ActiveCell.Row, ActiveCell.Column + 22).Value
TextBox14.Text = Cells(ActiveCell.Row, ActiveCell.Column + 23).Value
TextBox15.Text = Cells(ActiveCell.Row, ActiveCell.Column + 24).Value
TextBox16.Text = Cells(ActiveCell.Row, ActiveCell.Column + 25).Value

and how to make Textbox as an array on the form?
TextBox(1)....TextBox(2)....TextBox(3).... does work
"Not a legal object name : ....." show when I try to make those
array

thank you
 
Hi !..:: Enang ::..!,

Try:

Private Sub UserForm_Initialize()
Dim iCtr As Long

With ActiveCell
For iCtr = 1 To 10
Me.Controls("TextBox" & CStr(iCtr)).Text = _
.Offset(0, 9 + iCtr).Value
Next iCtr
End With
End Sub
 
Back
Top