I am having a problem with my Add/Edit Button.
What I want is if the textbox for my Record Number (TBrecord) has a value then I want it to go and edit that Record.
If the textbox doesn't have a value I want it to go to the lastRow available in my data worksheet and create a new Record number.
However, what it is doing is getting the value and going to that line number and then replacing the incorrect record.
What I want is if the textbox for my Record Number (TBrecord) has a value then I want it to go and edit that Record.
If the textbox doesn't have a value I want it to go to the lastRow available in my data worksheet and create a new Record number.
However, what it is doing is getting the value and going to that line number and then replacing the incorrect record.
VBA Code:
___________________________Add / Edit Record Button____________________________________________
Private Sub Add_Click()
If TBrecord.Value = "" Then
LastRow = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
EditRow = LastRow + 1
TBrecord = Format(EditRow.Value, "000")
Else: EditRow = TBrecord.Value
End If
'____________Information Frame________________________
Cells(EditRow, 1).Value = TBrecord.Value
Cells(EditRow, 2).Value = TBccxName.Text