Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Match listbox selection to worksheet row

Status
Not open for further replies.

imagoodwon

Technical User
Jan 14, 2010
10
US
Hi:

Not too well versed on this stuff!

I have a userform that gets populated by the user selecting values from a Listbox
I read values into some textboxes like this

Private Sub ListBox1_Change()
Set SourceRange = Range(ListBox1.RowSource)
TextBox1 = ListBox1.Value
TextBox2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1, 1).Value
TextBox3 = SourceRange.Offset(ListBox1.ListIndex, 2).Resize(1, 1).Value

Now I want to post values back to the worksheet based on the value currently selected in the ListBox. The new data is entered in Textboxes 6 -12

I've tried something like this
SourceRange.Offset(ListBox1.ListIndex, 2).Resize(1, 1).Value=TextBox6.Value
and
ListBox1.RowSource.Offset(0, 6).Value = TextBox6.Text

all of which gives me an error

Object required (Error 424)
Object required

Can anyone please suggest a workable solution.
Thanks
 
Never mind.
Got It:


Set SourceRange = Range(ListBox1.RowSource)
SourceRange(ListBox1.ListIndex, 8).Value = TextBox6.Value.

Finally figured it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top