Code:
Option Explicit
Private Trial As Long
[CODE]
Private Sub cmdCheck_Click()
'Declare the variables
Dim AddData As Range
Dim user As Variant
Dim Code As Variant
Dim result As Integer
Dim TitleStr As String
Dim Current As Range
Dim PName As Variant
Dim msg As VbMsgBoxResult

'Variables
user = Me.TxtUser.Value
Code = Me.TxtPass.Value
TitleStr = "Password check"
result = 0
Set Current = Sheet6.Range("K2")
'Error handler
On Error GoTo errHandler:
'Destination location for login storage
Set AddData = Sheet6.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
'Check the login and passcode for the administrator
If user = "Hardy Cross" And Code = 8118425 Then
MsgBox "Welcome Back: