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..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.