Add Data from User Form at Top Row below Headers with Excel VBA

How do I add data from user-form at top row below headers in Excel worksheet rather than the last row of the spread sheet so that my record shows most recent activities at the top. Watch the training video below:

Watch this video on YouTube.

Complete VBA or macro code for the command button to transfer data into the top row from the user-form into the Excel worksheet on click:

Private Sub CommandButton1_Click()
If Range(“a2”) <> “” Then
Rows(“2:2”).Select
selection.Insert shift:=xlDown
End If

If Range(“a2”) = “” Then
Range(“a2”) = TextBox1.Text
Range(“B2”) = TextBox2.Text
End If

TextBox1.Text = “”
TextBox2.Text = “”
Range(“C1”).Select
End Sub

One thought on “Add Data from User Form at Top Row below Headers with Excel VBA

  1. Jason

    Hi there!!

    Love your work and videos, but I need your help on a work project I’ve been working on for a WHILE now.

    For some reason I can’t get my UserForm to add the data to the row 2 below headers. Now I think i have it all messed up. Can I send a copy to you please?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *