ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   submiting from form to sheet (https://www.excelbanter.com/excel-programming/363521-submiting-form-sheet.html)

Darren

submiting from form to sheet
 
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?!

Bob

submiting from form to sheet
 
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

"Darren" wrote:

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?!



All times are GMT +1. The time now is 01:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com