I have a list of Usernames in column K. When a user opens the workbook I have code that checks that list, and if the current user ( Using Environ(Username)), isn't on the list it adds the user to the end of the list. If the username is already in the list it does nothing. It works great, but it seems like Windows doesn't care about the case sensitivity of the username when logging onto the computer, so Excel sees the same username differently depending on the upper and lower cases used to log in. For example: jsmith1 and JSmith1 should be the same, but excel sees them differently. How do I amend this code to use wildcards?
Code:
With Sheets("Sheet2")
For r = 1 To lastrow + 1
If .Cells(r, 11).Value = Environ("Username") Then
Exit For
ElseIf .Cells(r, 11).Value = "" Then
ThisWorkbook.Sheets("Sheet2").Cells(lastrow + 1, 11) = Environ("Username")
ThisWorkbook.Sheets("Sheet2").Cells(lastrow + 1, 12) = Format(Now, "mm/dd/yy hh:mm")
End If
Next r
End With
Last edited: