StopItPoppet
New Member
- Joined
- Nov 22, 2017
- Messages
- 7
Hi, as per the subject, i created a form using VBA and eventually got everything to work. Tested it a few times and then deleted the test rows. Now my form will not add new entries.
'write data to worksheet
RowCount = Worksheets("DATABASE").Range("A1").CurrentRegion.Rows.Count
With Worksheets("DATABASE").Range("A1")
.Offset(RowCount, 0).Value = Me.txtFirstName.Value
.Offset(RowCount, 1).Value = Me.TxtMiddle.Value
.Offset(RowCount, 2).Value = Me.txtSurname.Value
.Offset(RowCount, 3).Value = Me.txt1.Value
.Offset(RowCount, 4).Value = Me.txt2.Value
.Offset(RowCount, 5).Value = Me.txt3.Value
.Offset(RowCount, 6).Value = Me.TxtMarkedby.Value
.Offset(RowCount, 7).Value = Me.cboQualification.Value
.Offset(RowCount, 8).Value = Me.cboLocation.Value
.Offset(RowCount, 9).Value = Me.cboChannel.Value
.Offset(RowCount, 10).Value = Me.cboNationality.Value
.Offset(RowCount, 11).Value = Me.txtVD.Value
.Offset(RowCount, 12).Value = Me.txtComments.Value
.Offset(RowCount, 13).Value = Me.cboMethod.Value
.Offset(RowCount, 14).Value = Me.txtPartA.Value
.Offset(RowCount, 15).Value = Me.txtPartB.Value
End With
With ThisWorkbook.Worksheets("DATABASE")
RowCount = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(RowCount, 1).Value = Me.txtFirstName.Value
.Cells(RowCount, 2).Value = Me.TxtMiddle.Value
.Cells(RowCount, 3).Value = Me.txtSurname.Value
.Cells(RowCount, 4).Value = Me.txt1.Value
.Cells(RowCount, 5).Value = Me.txt2.Value
.Cells(RowCount, 6).Value = Me.txt3.Value
.Cells(RowCount, 7).Value = Me.TxtMarkedby.Value
.Cells(RowCount, 8).Value = Me.cboQualification.Value
.Cells(RowCount, 9).Value = Me.cboLocation.Value
.Cells(RowCount, 10).Value = Me.cboChannel.Value
.Cells(RowCount, 11).Value = Me.cboNationality.Value
.Cells(RowCount, 12).Value = Me.txtVD.Value
.Cells(RowCount, 13).Value = Me.txtComments.Value
.Cells(RowCount, 14).Value = Me.cboMethod.Value
.Cells(RowCount, 15).Value = Me.txtPartA.Value
.Cells(RowCount, 16).Value = Me.txtPartB.Value
End With