Userform to update rows of data
Hi all, new to the use of user forms but using guides available online I've managed to create one that allows for data to be added to a worksheet.
What I also need is the ability to edit the data using either the same or a different user form. Textbox2 is a unique ID that when recalled, I would like the user form to find the matching data in the table and allow to be overwritten.
Any help would be greatly appreciated - code for my existing userform below.
Many thanks in advance.
Private Sub Label1_Click()
End Sub
Private Sub Label11_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub TextBox5_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub CommandButton1_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("b65536").End(xlUp)
LastRow.Offset(10, 0).Value = TextBox1.Text
LastRow.Offset(10, 1).Value = TextBox2.Text
LastRow.Offset(10, 2).Value = TextBox3.Text
LastRow.Offset(10, 3).Value = TextBox4.Text
LastRow.Offset(10, 4).Value = TextBox5.Text
LastRow.Offset(10, 7).Value = TextBox6.Text
LastRow.Offset(10, 8).Value = TextBox7.Text
LastRow.Offset(10, 9).Value = TextBox8.Text
LastRow.Offset(10, 10).Value = TextBox9.Text
LastRow.Offset(10, 11).Value = TextBox10.Text
LastRow.Offset(10, 12).Value = TextBox11.Text
LastRow.Offset(10, 5).Value = TextBox12.Text
LastRow.Offset(10, 6).Value = TextBox13.Text
MsgBox "Variation details added"
response = MsgBox("Do you want to add another Variation?", _
vbYesNo)
If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
Private Sub CommandButton2_Click()
End
End Sub
|