Username and input sign-off

MGumbrell

Registered User.
Local time
Today, 01:12
Joined
Apr 22, 2005
Messages
129
Is it possible to validate/condition the user input to a cell. My worksheet requests muliple users to "sign-off" a row by entering thier intitial from a drop down.

What I would like to happen is that the initial can only be accepted by the corresponding username of the pc being used.

example: I could only enter MG using my PC as my user name is gumbrellm.

I hope that I have been clear in my question.

Regards, Matt
 
Code:
Private Declare Function GetUserName _
   Lib "advapi32.dll" Alias "GetUserNameA" _
   (ByVal lpBuffer as String, nSize as Long) _
   As Long   

Public Function UserName() as String

Dim sName as String * 256
Dim cChars as Long

cChars = 256

If GetUserName(sName, cChars) Then
   UserName = Left$(sName, cChars -1)
End If
End Function

Sub Bleh()

If UserName = "gumbrellm" Then
   ComboBox.Value = "MG"
End If

end Sub
 
Last edited:
Thank you

I will give that a whirl.

Regards, Matt
 

Users who are viewing this thread

Back
Top Bottom