Morning All,
So ive got a listbox which takes data from a sheet which then i can edit but i now want to send that edited data back to the same sheet and overwrite.
i know how to do it adding the data back to the sheet in the next clear cell (coded added)
can anyone help?
Code
- Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
- ProductFormEdit2.TextBox1.Text = Me.ListBox1.Column(0)
- 'ProdcutFormEdit2.TextBox2.Text = Me.ListBox1.Column(1)
- ProductFormEdit2.Show
- End Sub
- Private Sub UserForm_Initialize()
- Dim i As Long
- For i = 1 To Application.WorksheetFunction.CountA(Sheet4.Range("A:A"))
- Me.ListBox1.AddItem Sheet4.Cells(i, 1).Value
- Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Sheet4.Cells(i, 2).Value
- Next i
- End Sub
- Private Sub CommandButton1_Click()
- Dim r As Long, lrf As Long
- For r = 0 To ListBox1.ListCount - 1
- With Sheets("Suppliers")
- lrf = Sheets("Suppliers").Range("A" & Rows.Count).End(xlUp).Row
- Sheets("Suppliers").Range("A65000").End(xlUp).Offset(1, 0).Value = ListBox1.List(r, 0)
- Sheets("Suppliers").Range("A65000").End(xlUp).Offset(0, 1).Value = ListBox1.List(r, 1)
- End With
- Next r
- End Sub