I have a worksheet that users enter money transactions (deposits/payments) and then it keeps a running balance. It has 6 columns (A=Date, B=Activity (deposit/payment), C=Deposit, D=Payment, E=Balance (formula) and F=Name (on person making deposit/payment). I've create a user form to post entries on the worksheet, but am having difficulty with the following:
1. My original code looked for first available blank row - but on this
worksheet, I have pre-poulated data in each row (column E).
How can I tell it to look for first available blank cell AFTER row 6
and IN column A?
2. How can I tell it on the user form that fields: Date, Activity and Initial are required?
Here is the current code:
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Money")
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
ws.Cells(iRow, 1).Value = Me.txtDate.Value
ws.Cells(iRow, 2).Value = Me.txtActivity.Value
ws.Cells(iRow, 3).Value = Me.txtDeposit.Value
ws.Cells(iRow, 4).Value = Me.txtPayment.Value
ws.Cells(iRow, 6).Value = Me.txtName.Value
Me.txtDate.Value = ""
Me.txtActivity.Value = ""
Me.txtDeposit.Value = ""
Me.txtPayment.Value = ""
Me.txtName.Value = ""
Me.txtDate.SetFocus
End Sub
1. My original code looked for first available blank row - but on this
worksheet, I have pre-poulated data in each row (column E).
How can I tell it to look for first available blank cell AFTER row 6
and IN column A?
2. How can I tell it on the user form that fields: Date, Activity and Initial are required?
Here is the current code:
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Money")
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
ws.Cells(iRow, 1).Value = Me.txtDate.Value
ws.Cells(iRow, 2).Value = Me.txtActivity.Value
ws.Cells(iRow, 3).Value = Me.txtDeposit.Value
ws.Cells(iRow, 4).Value = Me.txtPayment.Value
ws.Cells(iRow, 6).Value = Me.txtName.Value
Me.txtDate.Value = ""
Me.txtActivity.Value = ""
Me.txtDeposit.Value = ""
Me.txtPayment.Value = ""
Me.txtName.Value = ""
Me.txtDate.SetFocus
End Sub