Hello
I need fixing this problem . this trade/ 1000 will show when run the usefrom and incerement when run every time but if I have next empty cell in column E when incerement should move next empty cell and inceremen and somtimes there is item like debt or paid also should move after cells contains debt or paid .
in other meaning should if the whole row is empty then should directly incerement in next empty cell
but if the row contains data except column E then should skip this row and move next and if the whole row contains data then shold also skip and move next mpty row and incerement .
first when run from the first time and press copy
after that will add some data
should incerement like this after press ok
and will add also data and should incerement like this
this the whole codes
I need fixing this problem . this trade/ 1000 will show when run the usefrom and incerement when run every time but if I have next empty cell in column E when incerement should move next empty cell and inceremen and somtimes there is item like debt or paid also should move after cells contains debt or paid .
in other meaning should if the whole row is empty then should directly incerement in next empty cell
but if the row contains data except column E then should skip this row and move next and if the whole row contains data then shold also skip and move next mpty row and incerement .
first when run from the first time and press copy
after that will add some data
should incerement like this after press ok
and will add also data and should incerement like this
this the whole codes
VBA Code:
Private Sub CommandButton2_Click()
Dim ss As String, Nxt As String, LstRw As Long
ss = "trade/ "
LstRw = Range("E" & Rows.Count).End(xlUp).Row
If LstRw = 1 Then
Nxt = ss & 1000
Else
Nxt = ss & Right(Cells(LstRw, 5).Value, 4) + 1
End If
Me.TextBox1 = Nxt
Cells(LstRw + 1, 5).Value = Nxt
End Sub
Private Sub UserForm_Initialize()
Dim ss As String, Nxt As String, LstRw As Long
ss = "trade/ "
'
LstRw = Range("E" & Rows.Count).End(xlUp).Row
If LstRw = 1 Then
Nxt = ss & 1000
Else
On Error Resume Next
Nxt = ss & Right(Cells(LstRw, 5).Value, 4) + 1
End If
Me.TextBox1 = Nxt
End Sub