Updating a Data List

  • Thread starter Thread starter Plamen A. Vachovski
  • Start date Start date
P

Plamen A. Vachovski

Would someone be so kind to provide a VBA code I can assign to a command
button on a user form that will transfer the data just entered in the form's
fields to a list located on a separate worksheet within the same workbook? I
would like each click of the button to update the list by adding new row and
then to clear the user form preparing it for new data entry. I don't want to
use MS Access for that function.

Thanks a lot!
 
In my example your command button (CommandButton1)
loads data from ten text boxes and a combo box into the
next available row on the designated sheet...its quite
easy to follow.
The text boxes are named textbox1, textbox2,..., textbox10
Finally the value of a combbox is also added.

Private Sub CommandButton1_Click()

Dim target As Range
Dim i As Long

target = Worksheets("Sheet1").Range("A65000").End
(xlUp).Offset(1, 0)

target.Value = Format$(Date, "dd-mm-yyyy")

For i = 1 To 10

target.Offset(0, i).Value = _
Controls("textbox" & i).Text
Controls("textbox" & i).Text = ""

Next

target.Offset(0, 11).Value = ComboBox1.Value

End Sub


This should get you started

Patrick Molloy
Microsoft Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top