Hi
experts
I have this code , but doesn't work correctly . when I add item into textbox 2 ,then should search for the lastrow in column A and autonumber in textbox1 .if the number in last row for column A is 1 , then when I add item into textbox 2 . the number should be 2 into textbox1 and if the lastrow in column A =2 ,then when I add item into textbox 2 the number should be 3 into textbox1
but it autonumbers starting 1 without see into last row in column A even if last row in column A 2 or 3 ...
any suggestion to fix it,please?
experts
I have this code , but doesn't work correctly . when I add item into textbox 2 ,then should search for the lastrow in column A and autonumber in textbox1 .if the number in last row for column A is 1 , then when I add item into textbox 2 . the number should be 2 into textbox1 and if the lastrow in column A =2 ,then when I add item into textbox 2 the number should be 3 into textbox1
but it autonumbers starting 1 without see into last row in column A even if last row in column A 2 or 3 ...
VBA Code:
Private Sub TextBox2_Change()
If TextBox2 <> "" Then
ks = WorksheetFunction.CountA(Range("a2:a1000"))
TextBox1.Value = ks + 1
Else
TextBox1.Value = ""
End If
End Sub