submiting from form to sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to take information froma user form and submit it to my sheet 1
and every time a new record is entered it must go on to a new row. can anyone
help?!
 
Hi Darren
Place the code in the userform of the button that you will be using to add
the info

Private Sub CommandButton1_Click()
Dim nextrow As Integer
nextrow = FirstBlankRow(1, 1)

Cells(nextrow, 1) = txtEmployeeName
Cells(nextrow, 2) = txtSSN
Cells(nextrow, 3) = txtAddress
Cells(nextrow, 4) = txtCity
End Sub

Function FirstBlankRow(KeyColumn As Integer, startrow As Long) As Long
Dim i As Long

i = 0
Do While ActiveSheet.Cells(startrow + i, KeyColumn).Text <> ""
i = i + 1
Loop
FirstBlankRow = startrow + i
End Function

Bob
 

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