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
selection.Insert shift:=xlDown
End If

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

TextBox1.Text = “”
TextBox2.Text = “”
End Sub

Published by

Dinesh Kumar Takyar

Welcome to! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: For a structured Excel VBA training course online you can visit:

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

  1. 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?

Leave a Reply

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