Does anyone know how to adapt the code below to kick you out the spreadsheet if you press enter without typing a username or cancel?
Also, the restrict the username so that it will only accept one username rather than any old text?
Thanks
Private Sub Workbook_Open()
Dim user_name As String
Dim FBR As Long 'First Blank Row
'instead of the default "", you can use Application.UserName)
user_name = Application.InputBox("name please", "title", "")
With Sheets("login")
FBR = .Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
.Cells(FBR, 2) = user_name
.Cells(FBR, 1) = Now
End With
End Sub
Also, the restrict the username so that it will only accept one username rather than any old text?
Thanks
Private Sub Workbook_Open()
Dim user_name As String
Dim FBR As Long 'First Blank Row
'instead of the default "", you can use Application.UserName)
user_name = Application.InputBox("name please", "title", "")
With Sheets("login")
FBR = .Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
.Cells(FBR, 2) = user_name
.Cells(FBR, 1) = Now
End With
End Sub