Userform - find first blank cell and required field

Ritz

Board Regular
Joined
Sep 22, 2004
Messages
90
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
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top