It's bound to be so simple. I just can't get this to work.
I have a hidden sheet which contains a list of Usernames and their access level. I'm trying to pull the access level by searching the list with the Username.
I've got code as follows
I get an empty value for the access level in all cases. Where is the mistake? I've stepped through this, checked the TT FAQs and even tried VBA Help itself. No joy.
Can anyone explain what I'm doing wrong?
Cheers!
David
[joinedupwriting]
"whaddaya mean, 'invalid tag'?!?"
[/joinedupwriting]
![[lightsaber] [lightsaber] [lightsaber]](/data/assets/smilies/lightsaber.gif)
I have a hidden sheet which contains a list of Usernames and their access level. I'm trying to pull the access level by searching the list with the Username.
I've got code as follows
Code:
uName = Application.UserName
Application.ScreenUpdating = False
Worksheets("Sheet3").Activate
With ActiveSheet.Range("A2 : A102")
Set Namefind = .Find(uName)
If Namefind Is Nothing Then
MsgBox ("User not known to system")
ActiveWorkbook.Close
End If
'otherwise user must have been found
ActiveCell(Namefind).Select
access_level = ActiveCell.Offset(columnoffset:=2).Value
MsgBox ("Welcome, " & uName & ". You have " & access_level & " access.")
End With
End Sub
I get an empty value for the access level in all cases. Where is the mistake? I've stepped through this, checked the TT FAQs and even tried VBA Help itself. No joy.
Can anyone explain what I'm doing wrong?
Cheers!
David
[joinedupwriting]
"whaddaya mean, 'invalid tag'?!?"
[/joinedupwriting]
![[lightsaber] [lightsaber] [lightsaber]](/data/assets/smilies/lightsaber.gif)