Restrict access to portions of the Sheet to specific users?

CritterLes

New Member
Joined
Oct 12, 2015
Messages
14
I Have a sheet that has data for 5 different classes. Each class should be viewed by only 1 teacher. Is there a way to define sections of the sheet and then give that access to individual users?

I tried doing this with different worksheets and it's great up to the point where I have to append all the individuals sheets into one. The append process has been a challenge to automate into a button activated macro.
Any ideas out there?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You might try setting up a sheet level macro triggered on sheet activation to look at the current user and hide/show ranges based off of what user is viewing.

Code:
Private Sub Worksheet_Activate()
Select Case Application.UserName
    Case "John Doe"
        Range("A1:A10").EntireRow.Hidden = False
        Range("A11:A30").EntireRow.Hidden = True
    Case "Jane Smith"
        Range("A1:A30").EntireRow.Hidden = True
        Range("A11:A20").EntireRow.Hidden = False
    Case Else
        Range("A1:A30").EntireRow.Hidden = True
End Select
End Sub
 
Upvote 0
My appologies. Yes, this is a macro (VB code) to look at the username of the person logged into the computer running your workbook. If you've never worked with Visual Basic, it may be a bit complex at first.

Are you comfortable with using macros and vb coding? If so I can explain a bit more.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top