Hi All,
This code was working less than 2 days ago and now it's just suddenly stopped working.
Can anyone work out why it has failed?
Debug stated the following lines are the issue.
rng.Parent.Cells(LastRow + 1, 2).Value = SurnameTextBox.Value
rng.Parent.Cells(LastRow + 1, 3).Value = USITextBox.Value
rng.Parent.Cells(LastRow + 1, 4).Value = EmployerTextBox.Value
rng.Parent.Cells(LastRow + 1, 5).Value = DOBTextBox.Value
rng.Parent.Cells(LastRow + 1, 6).Value = EmailTextBox.Value
rng.Parent.Cells(LastRow + 1, 7).Value = PositionTextBox.Value
Take in mind I haven't changed the coding since it was working either.
Any help would be appreciated.
Thank you.
This code was working less than 2 days ago and now it's just suddenly stopped working.
Can anyone work out why it has failed?
Debug stated the following lines are the issue.
rng.Parent.Cells(LastRow + 1, 2).Value = SurnameTextBox.Value
rng.Parent.Cells(LastRow + 1, 3).Value = USITextBox.Value
rng.Parent.Cells(LastRow + 1, 4).Value = EmployerTextBox.Value
rng.Parent.Cells(LastRow + 1, 5).Value = DOBTextBox.Value
rng.Parent.Cells(LastRow + 1, 6).Value = EmailTextBox.Value
rng.Parent.Cells(LastRow + 1, 7).Value = PositionTextBox.Value
Take in mind I haven't changed the coding since it was working either.
VBA Code:
Private Sub RegisterButton_Click()
ActiveSheet.Unprotect "DMTR20"
Dim rng As Range
Set rng = ActiveSheet.ListObjects("Table1").Range
Dim LastRow As Long
LastRow = rng.Find(What:="*", _
After:=rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
rng.Parent.Cells(LastRow + 1, 1).Value = NameTextBox.Value
rng.Parent.Cells(LastRow + 1, 2).Value = SurnameTextBox.Value
rng.Parent.Cells(LastRow + 1, 3).Value = USITextBox.Value
rng.Parent.Cells(LastRow + 1, 4).Value = EmployerTextBox.Value
rng.Parent.Cells(LastRow + 1, 5).Value = DOBTextBox.Value
rng.Parent.Cells(LastRow + 1, 6).Value = EmailTextBox.Value
rng.Parent.Cells(LastRow + 1, 7).Value = PositionTextBox.Value
ActiveSheet.Protect "DMTR20"
End Sub
Any help would be appreciated.
Thank you.