Hello All,
I have the following code that works really well. What I would like to do though, is have a list on a worksheet where people can add their usernames and become part of the AdminAccess group. In the italicized line, I would like to use variables to pull the cell value from that sheet/column (Sheets("Lists").Range("F1").Value (through F25 Value)). When I attempted to Dim some set of variables and put them in there I can't get it to work. Any ideas? I have already tried the variable individually both with and without the "" and I tried using an array() which also didn't work.
I have the following code that works really well. What I would like to do though, is have a list on a worksheet where people can add their usernames and become part of the AdminAccess group. In the italicized line, I would like to use variables to pull the cell value from that sheet/column (Sheets("Lists").Range("F1").Value (through F25 Value)). When I attempted to Dim some set of variables and put them in there I can't get it to work. Any ideas? I have already tried the variable individually both with and without the "" and I tried using an array() which also didn't work.
Code:
Login = Environ("UserName") 'Environ("UserName") grabs the login name attached to your profile on your computer
[I] AdminAccess = InStr("burnsjas-mslinde-jodruin", Login) > 0[/I]
If AdminAccess Then
Columns("K:K").Select
ActiveWorkbook.Worksheets("Data").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Data").Sort.SortFields.Add Key:=Range("K1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Data").Sort
.SetRange Range("A2:M1000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If