:confused:I need help making this work for editing listbox items. only the first item/textbox1/column A gets modified. i posted a sample file in another thread but i figure out it’s better to make a smaller request: Could someone please tell me what’s wrong with this code. it does work in a 2 colum listbox but not in this 8 column listbox. my rowsource is defined as : VendorList: =OFFSET(Vendors!$A$1,1,0,COUNTA(Vendors!$A:$A)-1,8)
Thank you.
Sample file: 46868-PO
Private Sub cmdVendorModify_Click() ‘change button for Vendors Dim a As Byte If ListBox4.ListIndex = -1 Then MsgBox “Choose an item from the list!”, vbExclamation Exit Sub End If If ListBox4.ListIndex -1 Then With ListBox4 Range(“VendorList”)((.ListIndex * 8) + 1) = Me.TextBox1.Value Range(“VendorList”)((.ListIndex * 8) + 2) = Me.TextBox2.Value Range(“VendorList”)((.ListIndex * 8) + 3) = Me.TextBox3.Value Range(“VendorList”)((.ListIndex * 8) + 4) = Me.TextBox4.Value Range(“VendorList”)((.ListIndex * 8) + 5) = Me.TextBox5.Value Range(“VendorList”)((.ListIndex * 8) + 6) = Me.TextBox6.Value Range(“VendorList”)((.ListIndex * 8) + 7) = Me.TextBox7.Value Range(“VendorList”)((.ListIndex * 8) + 8) = Me.TextBox8.Value End With End If Frame4.Visible = True Call Main ‘Progress Bar Frame4.Visible = False TextBox13.Value = “”: ComboBox1.Value = “” Label15.Caption = “” ListBox4.RowSource = “VendorList” ‘for refreshing vendors listbox ListBox4.ListIndex = -1 For a = 1 To 8 Controls(“textbox” & a) = “” Next MsgBox “Item has been updated” ThisWorkbook.Save End Sub