Hi All, Can someone help with my sub. I'm trying to get it to do the fllowing. IF the user presses cancel the sub exits, if they enter nothing it loops until they do and if they do enter something then it runs another sub to check what they have entered is valid. I've tried userName = False but it gives type mismatch. I've tried userName = "" but then it just keeps looping as I need <>"" to do something else. Can anyone help. Regards, John
Sub Use()
Dim userName As Variant
Dim nameOk As Boolean
Dim username2 As String
userName = Application.Proper(InputBox("Enter Name", "Name"))
username2 = userName
If userName = "" Then
Exit Sub
ElseIf (userName <> "") Then nameOk = ValidateName(username2)
Else: MsgBox "ok"
End If
' Loop While (userName <> "")
End Sub
Bookmarks