I have a Userform that transfers data, sort of. I need to change the code, as it doesn't do what I need it to do. What ends up happening is that it creates a new row at the end of the table (good!). What it doesn't do, is add the userform data to that new row, but instead overwrites the data in row 5 (bad!). My table starts on A3 (headers), data starts on A4
I also need code to create a unique transaction #. As simple as 1, 2, 3, etc... that is automatically added when the user clicks the Save button. The transaction # should NOT be reset if a user deletes a row. For example, table shows Transaciton # 1, 2, 3. User deletes transaction 2 and then adds a new line of data using the form. This new line of data should be transaction 4. Transaction 2 is just gone forever.
The transaction # should be in Row A.
Below is my current code;
I also need code to create a unique transaction #. As simple as 1, 2, 3, etc... that is automatically added when the user clicks the Save button. The transaction # should NOT be reset if a user deletes a row. For example, table shows Transaciton # 1, 2, 3. User deletes transaction 2 and then adds a new line of data using the form. This new line of data should be transaction 4. Transaction 2 is just gone forever.
The transaction # should be in Row A.
Below is my current code;
Code:
' Transfer Userform Data
With Worksheets("Bookkeeping").Range("A4")
.ListObject.ListRows.Add
.Offset(1, 1).Value = ExpIncDrop.Value
If ExpIncDrop.Value = "Expense" Then
.Offset(1, 2).Value = TypeDrop.Value
Else
.Offset(1, 3).Value = TypeDrop.Value
End If
.Offset(1, 4).Value = DateTxt.Value
.Offset(1, 5).Value = AmountTxt.Value
.Offset(1, 6).Value = RemarksTxt.Value
End With
Last edited: