I have the following code:
Private Sub cmdSubmit_Click()
Dim lastrow As Long
With Sheets("DATABASE")
lastrow = .Range("A2").End(xlDown).Row
.Cells(lastrow + 1, 1).Value = txtLastName.Text & ", " & txtFirstName.Text
.Cells(lastrow + 1, 2).Value = txtCCN.Text
.Cells(lastrow + 1, 3).Value = txtDateofhire.Text
.Cells(lastrow, 4).Resize(1, 6).Copy .Cells(lastrow + 1, 4)
Sheets("DATABASE").Cells(lastrow).Show
End With
Application.CutCopyMode = False
txtFirstName = ""
txtLastName = ""
txtCCN = ""
txtDateofhire = ""
End Sub
and I would like when the Command Button is clicked for the DATABASE sheet to show with the focus on the last row. I thought
Sheets("DATABASE").Cells(lastrow).Show
would do it, but apparently not.
Bookmarks