Hi,
I'm having 2 issues with this code.
1) When the data is loading into the worksheet, its not starting in the table - its beginning from the row below the table. I want the data to be loaded into the first row of the table every time a new row is added.
2) The checkbox will not clear so when opening the "Add Tenant" form via a command button - the checkbox is already clicked.
Any help on this would be appreciated.
Code
Private Sub AddTenant_Click()
' Copy input values to sheet.
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Tenant List")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.Tenant.Value
.Cells(lRow, 2).Value = Me.DOB.Value
.Cells(lRow, 3).Value = Me.Address.Value
.Cells(lRow, 4).Value = Me.House.Value
.Cells(lRow, 5).Value = Me.Flat.Value
.Cells(lRow, 6).Value = Me.InDate.Value
.Cells(lRow, 7).Value = Me.OutDate.Value
.Cells(lRow, 8).Value = Me.PayDay.Value
.Cells(lRow, 10).Value = Me.Deposit.Value
If CheckBox1.Value Then
.Cells(lRow, 9).Value = "Yes"
Else: .Cells(lRow, 9).Value = "No"
End If
End With
'Clear input controls.
Me.Tenant.Value = ""
Me.DOB.Value = ""
Me.Address.Value = ""
Me.House.Value = ""
Me.Flat.Value = ""
Me.InDate.Value = ""
Me.OutDate.Value = ""
Me.PayDay.Value = ""
Me.CheckBox1.Value = False
Me.Deposit.Value = ""
End Sub
Display More