hi,
I need to add data into a Table, i can currently add data to the last cell however it is not adding it in the table set,
i am using a userform to add the data into the next blank cells, however the data it entered is not added within the table but underneath it, here is my current code i am using
please assist in guiding me on how to let the data fall within the table
Private Sub CommandButton1_Click()
Dim LastRow As Object
Dim myPWD As String
myPWD = "Test"
Sheets("Child_name").Unprotect Password:=myPWD
Set LastRow = Sheets("Child_name").Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox6.Text
LastRow.Offset(1, 3).Value = TextBox4.Text
LastRow.Offset(1, 4).Value = TextBox5.Text
LastRow.Offset(1, 5).Value = TextBox3.Text
If CheckBox1.Value = True Then
LastRow.Offset(1, 6).Value = "Yes"
Else
LastRow.Offset(1, 6).Value = "No"
End If
MsgBox "Record Added"
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
CheckBox1.Value = False
TextBox1.SetFocus
Else
Unload Me
End If
Sheets("Child_name").Protect Password:=myPWD
End Sub
Bookmarks