Hi,
I have two separate tables (one is a list of Users and User Profiles and the other is a corresponding list of User Profiles and what rights each has)
TABLE 1 - Users and User Profiles
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]USERS[/TD]
[TD="align: center"]Accounts[/TD]
[TD="align: center"]Admin[/TD]
[TD="align: center"]Master Roster[/TD]
[TD="align: center"]Extrant[/TD]
[TD="align: center"]Basic MIS[/TD]
[TD="align: center"]MIS[/TD]
[TD="align: center"]Sunk VTS[/TD]
[TD="align: center"]VTS[/TD]
[/TR]
[TR]
[TD]User 1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 2[/TD]
[TD][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 3[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 7[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 8[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[/TR]
[TR]
[TD]User 9[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[/TR]
</tbody>[/TABLE]
TABLE 2 - User Profiles and Rights
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]RIGHTS[/TD]
[TD]Accounts[/TD]
[TD]Admin[/TD]
[TD]Master Roster[/TD]
[TD]Extrant[/TD]
[TD]Basic MIS[/TD]
[TD]MIS[/TD]
[TD]Sunk VTS[/TD]
[TD]VTS[/TD]
[/TR]
[TR]
[TD][TABLE="width: 279"]
<tbody>[TR]
[TD="width: 279"]Pilotage Write[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Pilotage Read[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]Roster Write[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Roster Read[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]Security Write[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Security Read[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
</tbody>[/TABLE]
What I am after is a list of the Rights each User has in the next coulmn of Table 1 and then offsetting by one column when there is multiple Rights (See below).
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]USERS[/TD]
[TD="align: center"]Accounts[/TD]
[TD="align: center"]Admin[/TD]
[TD="align: center"]Master Roster[/TD]
[TD="align: center"]Extrant[/TD]
[TD="align: center"]Basic MIS[/TD]
[TD="align: center"]MIS[/TD]
[TD="align: center"]Sunk VTS[/TD]
[TD="align: center"]VTS[/TD]
[TD="align: center"]Right 1[/TD]
[TD="align: center"]Right 2[/TD]
[TD="align: center"]Right 3[/TD]
[/TR]
[TR]
[TD]User 1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]x[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]Pilotage Write[/TD]
[TD="align: center"]Roster Write[/TD]
[TD="align: center"]Security Write[/TD]
[/TR]
</tbody>[/TABLE]
I have got to the point where i have got the code (see below) to look down one column of User Profiles and return all the Rights but now I am a little stuck.
Any help greatly received, thanks!
I have two separate tables (one is a list of Users and User Profiles and the other is a corresponding list of User Profiles and what rights each has)
TABLE 1 - Users and User Profiles
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]USERS[/TD]
[TD="align: center"]Accounts[/TD]
[TD="align: center"]Admin[/TD]
[TD="align: center"]Master Roster[/TD]
[TD="align: center"]Extrant[/TD]
[TD="align: center"]Basic MIS[/TD]
[TD="align: center"]MIS[/TD]
[TD="align: center"]Sunk VTS[/TD]
[TD="align: center"]VTS[/TD]
[/TR]
[TR]
[TD]User 1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 2[/TD]
[TD][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 3[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 7[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]User 8[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[/TR]
[TR]
[TD]User 9[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[TD="align: center"][/TD]
[TD="align: center"]X[/TD]
[/TR]
</tbody>[/TABLE]
TABLE 2 - User Profiles and Rights
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]RIGHTS[/TD]
[TD]Accounts[/TD]
[TD]Admin[/TD]
[TD]Master Roster[/TD]
[TD]Extrant[/TD]
[TD]Basic MIS[/TD]
[TD]MIS[/TD]
[TD]Sunk VTS[/TD]
[TD]VTS[/TD]
[/TR]
[TR]
[TD][TABLE="width: 279"]
<tbody>[TR]
[TD="width: 279"]Pilotage Write[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Pilotage Read[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]Roster Write[/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD]X[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Roster Read[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]Security Write[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Security Read[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[/TR]
</tbody>[/TABLE]
What I am after is a list of the Rights each User has in the next coulmn of Table 1 and then offsetting by one column when there is multiple Rights (See below).
[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD]USERS[/TD]
[TD="align: center"]Accounts[/TD]
[TD="align: center"]Admin[/TD]
[TD="align: center"]Master Roster[/TD]
[TD="align: center"]Extrant[/TD]
[TD="align: center"]Basic MIS[/TD]
[TD="align: center"]MIS[/TD]
[TD="align: center"]Sunk VTS[/TD]
[TD="align: center"]VTS[/TD]
[TD="align: center"]Right 1[/TD]
[TD="align: center"]Right 2[/TD]
[TD="align: center"]Right 3[/TD]
[/TR]
[TR]
[TD]User 1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]x[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]Pilotage Write[/TD]
[TD="align: center"]Roster Write[/TD]
[TD="align: center"]Security Write[/TD]
[/TR]
</tbody>[/TABLE]
I have got to the point where i have got the code (see below) to look down one column of User Profiles and return all the Rights but now I am a little stuck.
Code:
Sub SearchX()
Dim LR As Long, i As Long, LC As Long
With Sheets("Roles")
LR = .Range("D" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With .Range("D" & i)
If .Value = "x" Then
Sheets("Roles").Range("C" & i).Copy Destination:=Sheets("Roles").Range("AN" & i)
End If
End With
Next i
End With
End Sub
Any help greatly received, thanks!