Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Userform to Populate Excel Sheet (On Next Available Line) I\'m not sure how to m

ID: 638687 • Letter: U

Question

Userform to Populate Excel Sheet (On Next Available Line)

I'm not sure how to make this work in VBA. This is what I need to accomplish:

[EXAMPLE]
For simplicity, let's use a simple example. Let's say I have an Excel sheet "Sheet1" with:

Column A = Dates
Column B = Purchase Amounts
Column C = Text Description of Transaction

Let's say that data has filled up each of those cells through Row 12.
[END OF EXAMPLE]


NOW, I need a UserForm (that I will have pop-up and have spots for these same 3 categories) to take the user inputted information and populate it to the next available row. I would like the user to be able to do this for every row if they wanted to using the UserForm.

Thanks for help !!

Explanation / Answer

Hi..

Put a command button cmdOK on the userform, with caption OK, and with the following code:

Private Sub cmdOK_Click().
    Dim r As Long
    With Worksheets("Sheet1")
        r = .Range("A" & .Rows.Count).End(xlUp).Row + 1
        .Range("A" & r) = Me.txtDate
        .Range("B" & r) = Me.txtAmount
        .Range("C" & r) = Me.txtDescription
    End With
End Sub

Substitute the names of the text boxes on your userform..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote