Hi,
This is screencapture of a simple userform I have created:
ScreenHunter 20180626 Image 004.jpg
I want the data for txtName, txtID, txtEmailAddress and txtMobileNumber to be added to LastRow +1 of wsDatabase
This is the code I have written for the command button "Add New":
Private Sub cmdAddNew_Click()
Dim LastCell As Range
Dim txtName, txtEmailAddress As String
Dim txtID, txtMobileNumber As Long
Set LastCell = wsDatabase.Cells(Rows.Count, 1).End(xlUp)
With LastCell
.Offset(1, 0) = txtName
.Offset(1, 1) = txtID
.Offset(1, 2) = txtEmailAddress
.Offset(1, 3) = txtMobileNumber
End With
End Sub
After running the macro, this is the result (only Column D is updated with "0", Columns A to C not updated)
ScreenHunter 20180626 Image 008.jpg
Can I ask what am I not doing right? Thank you.
Bookmarks