Ethan
08-27-2011, 09:57 AM
Hello all,
I try to update cells via an userform that is called by selecting a row on a listbox. However at this stage it keeps on giving an error ut can't figure out why.
Perhaps one of you can help me out.
It's just in a beginning stage so please don't mind the formula errors and the names of the textboxes on the userform that don't match the names of tle listbox. Thi has no influence on the coding though.
I think the error is in the "initialize" part of the code:
Private Sub UserForm_Initialize()
Dim LB As MSForms.ListBox
Dim I As Long
Set LB = Worksheets("Sheet1").OLEObjects("Listbox1").Object
With LB
For I = 1 To .ColumnCount
Me.Controls("TextBox" & I).Text = .List(.ListIndex, I - 1)
Next I
End With
I try to update cells via an userform that is called by selecting a row on a listbox. However at this stage it keeps on giving an error ut can't figure out why.
Perhaps one of you can help me out.
It's just in a beginning stage so please don't mind the formula errors and the names of the textboxes on the userform that don't match the names of tle listbox. Thi has no influence on the coding though.
I think the error is in the "initialize" part of the code:
Private Sub UserForm_Initialize()
Dim LB As MSForms.ListBox
Dim I As Long
Set LB = Worksheets("Sheet1").OLEObjects("Listbox1").Object
With LB
For I = 1 To .ColumnCount
Me.Controls("TextBox" & I).Text = .List(.ListIndex, I - 1)
Next I
End With