+ Reply to Thread
Results 1 to 2 of 2

Give permission for specific ranges to variable users

  1. #1
    Registered User
    Join Date
    11-03-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    1

    Give permission for specific ranges to variable users

    I want to protect specific Ranges in an Excel Sheet, but I want to give a permission for some Users. I know, that I can use:

    Review> Changes> Allow Users to Edit Ranges > Permissions

    But these Users are variable. I would like to write a macro that gives access to variable users. At the same time just the admin should know the password. Has anyone an idea how it might look like?

    Best Regards Markus

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Give permission for specific ranges to variable users

    There are probably a number of ways however the basic principle should be:

    In the Workbook_Open event

    Check the username, this all depends on how you have your users set up. Do they have to log into the system? or can you use the User info from windows to identify them? (for instance, our systems in my workplace hold the persons Staff Number as the login user so we are able to refer to that automatically to identify the user. You can use
    Please Login or Register  to view this content.
    to get the logged in user however depending on how your network is set up that may not contain the unique info you need.

    Once you have the username then check it against a list in the workbook to see if its one of the allowed users. (depending on the importance of this data you may wish to make this a little more secure such as querying a database etc so the table of users cant be manipulated).

    If so, run a Sub that unprotects the relevant ranges.

    Something to note though, if the workbook will then be saved by the user for the next person to access you'll need to reset all of the Protections before closing the sheet otherwise it will be open by default for the next user.
    If someone has helped you then please add to their Reputation

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 12-15-2014, 04:23 PM
  2. Replies: 0
    Last Post: 04-07-2014, 10:01 AM
  3. Allow Users to Edit Ranges Using Users from a Network Location
    By Tayque_J_Holmes in forum Excel General
    Replies: 0
    Last Post: 10-24-2013, 06:34 AM
  4. Replies: 2
    Last Post: 02-11-2013, 08:44 AM
  5. Replies: 2
    Last Post: 12-15-2011, 12:13 PM
  6. 2003: Expire and reset permission to use at users site
    By phstol in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-24-2009, 11:50 AM
  7. How do I give permission for certain functions in excel in locked.
    By tradinoncoffee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-02-2005, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1