Anthony Evans
New Member
Hi
I'm a slightly better than novice user who would like to copy/move data from a userform to a table in a worksheet.
I have attached the file to enable you to better understand, so what I would like to achieve is to move the data from the userform and put it into the 'data' table on the input sheet.
I have tried this code, but I don't understand it well enough to tailor it to my needs.
I understand the last few lines that move the data (although not sure how to manage a check box) and also the commands to reset the form, but the part at the top (Dim lRow...) is way beyond me at the moment.
Any help and guidance would very much be welcomed.
Thank you for your help
Anthony
I'm a slightly better than novice user who would like to copy/move data from a userform to a table in a worksheet.
I have attached the file to enable you to better understand, so what I would like to achieve is to move the data from the userform and put it into the 'data' table on the input sheet.
I have tried this code, but I don't understand it well enough to tailor it to my needs.
Code:
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Animals")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.cboClass.Value
.Cells(lRow, 2).Value = Me.txtGivenName.Value
.Cells(lRow, 3).Value = Me.txtTagNumber.Value
.Cells(lRow, 4).Value = Me.txtSpecies.Value
.Cells(lRow, 5).Value = Me.cboSex.Value
.Cells(lRow, 6).Value = Me.cboConservationStatus.Value
.Cells(lRow, 7).Value = Me.txtComment.Value
End With
'Clear input controls.
Me.cboClass.Value = ""
Me.txtGivenName.Value = ""
Me.txtTagNumber.Value = ""
Me.txtSpecies.Value = ""
Me.cboSex.Value = ""
Me.cboConservationStatus.Value = ""
Me.txtComment.Value = ""
End Sub
I understand the last few lines that move the data (although not sure how to manage a check box) and also the commands to reset the form, but the part at the top (Dim lRow...) is way beyond me at the moment.
Any help and guidance would very much be welcomed.
Thank you for your help
Anthony