+ Reply to Thread
Results 1 to 10 of 10

Allow diiferrent users to access different ranges to input data

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Allow diiferrent users to access different ranges to input data

    Hi All

    I created a worksheet (attached) using Excel 2010. The worksheet “January” has been format for data input from a dropdown menu and conditional formatting corresponding to a legend in the worksheet. So far all okay, I have completed my worksheet on that basis.

    The next step is where I encounter the problem: I intend to share this workbook so that at any time any of the 10 users can open the file and input their own data into the worksheet. To do this, I use “Review”, “Allow users to Edit Ranges”. In order to prevent conflict of data during input, I am password protecting each of the ranges that each of them can excess; e.g. user NWP will only be allowed to input data into the green cells in row 19 where marked “Avail”- after inputing her password “NWP”

    I now wish to do the same thing for each of the 10 users using their initial as their individual password. I found that I cannot simply copy and paste from the row 19 to the other rows as the ranges in the menu “Review”, “Allow users to Edit Ranges” use absolute ranges and not relative ranges.

    In my example, I have used 10 users only but in reality I may have up to 300 rows (users).

    Can someone help me resolve this please, with a macro perhaps? I am only a basic user. Many thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Allow diiferrent users to access different ranges to input data

    Just from the top of my head (I glanced at your file, but need to leave in 5 mins) - wouldn't it be possible to set allowed ranges to change based on username?

    You can catch the username by the environ command. I would imagine to say " if username is 'Jane' then allowed range = 'A1:F1'"

    So you get something like:

    Please Login or Register  to view this content.
    Please click the * below if this helps
    Please click the * below if this helps

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Allow diiferrent users to access different ranges to input data

    Thanks JaperD. I am a basic Excel user and am not familiar with macros or VBA. But from what you wrote in the script, wouldn't this mean that I have to type in the user names and their respective ranges line by line into the above script? If that is so, then it is almost the same as me having to use the "Review”, “Allow users to Edit Ranges” menu to input the function for each user. Another requirement is that I a will be using the user name as the name of the range and also their respective passwords for accessing their respective ranges.
    Last edited by jeffreybrown; 09-14-2013 at 09:56 AM. Reason: As per Forum Rule #12, please don't quote whole post unless necessary -- it's just clutter.

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Allow diiferrent users to access different ranges to input data

    I wouldn't use any password.
    If you adjust the code as below and just put their (windows)usernames in the sheet, they will only be able to adjust the row which holds their username.
    This saves you having to set ranges and it saves you having to work with passwords.

    You can insert this code by pressing ALT+F11 - then on the left side of the screen, double click on Sheet5 (January) and paste the code in the big white box on the right.
    Then close this window to go back to excel and it should work.
    If this is not what you want, then I can't help you

    Please Login or Register  to view this content.
    Please remember to click the * below if this helps

  5. #5
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Allow diiferrent users to access different ranges to input data

    Thanks again for the quick response. Yes, I think your suggestion should work as long as each user can only edit their respective row against their user name.

    I would like to try out what you say but as mentioned I am not familiar with macros and VBA. Can you help by providing me with a step by step instruction on what you meant by "If you adjust the code as below and just put their (windows)usernames in the sheet, they will only be able to adjust the row which holds their username" For this purpose, I would like to use the usernames as indicated in the attached worksheet. What about the other months if I need to create a similar worksheet on a different page. How do I do this? Much appreciated.

  6. #6
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Allow diiferrent users to access different ranges to input data

    Quote Originally Posted by boonfootan View Post
    Thanks again for the quick response. Yes, I think your suggestion should work as long as each user can only edit their respective row against their user name.

    I would like to try out what you say but as mentioned I am not familiar with macros and VBA. Can you help by providing me with a step by step instruction on what you meant by "If you adjust the code as below and just put their (windows)usernames in the sheet, they will only be able to adjust the row which holds their username" For this purpose, I would like to use the usernames as indicated in the attached worksheet. What about the other months if I need to create a similar worksheet on a different page. How do I do this? Much appreciated.
    Hi JasperD

    I tried what you said based on my understanding of what you wrote above and it worked: I just copied and paste the code you wrote into the white space after pressing Alt+F11. Then saved the file and it worked. I think the important thing is for the user names in column A to match the respective users' Windows login names before access will be given for that particular row for data input.

    Now what do I do if I need to disable the code temporarily to make changes to the users' names (add or delete user names in column A) and to re-activate the code after the edits. Is there any keystroke that I can press to toggle the code on and off?

    Once again many thanks. Much appreciated

  7. #7
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Allow diiferrent users to access different ranges to input data

    Quote Originally Posted by boonfootan View Post
    Hi JasperD

    I tried what you said based on my understanding of what you wrote above and it worked: I just copied and paste the code you wrote into the white space after pressing Alt+F11. Then saved the file and it worked. I think the important thing is for the user names in column A to match the respective users' Windows login names before access will be given for that particular row for data input.

    Now what do I do if I need to disable the code temporarily to make changes to the users' names (add or delete user names in column A) and to re-activate the code after the edits. Is there any keystroke that I can press to toggle the code on and off?

    Once again many thanks. Much appreciated
    Sorry, JaperD: another question arose as I was testing this code out. Appears that it works only for January Sheet5 as I only uploaded this worksheet for your advice initially. Sheet5 is just one worksheet of a larger workbook with all of the 12 months on a separate worksheet each with a similar layout. How do I get this to work on the other sheets in the same workbook in addition to the query I have on toggling the code on and off above for editing purpose. Thanks for the help.

  8. #8
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Allow diiferrent users to access different ranges to input data

    Q1 - toggle on/off :

    Press CTRL+F11
    Press CTRL+G
    Type : application.enableevents = false (ENTER)
    To toggle off
    Type : application.enableevents = true (ENTER)
    To toggle on

    Q2 -
    Just paste the code into each worksheet code area

    You need to add a little bit of extra code later, but I'm driving right now, so will tell you later

  9. #9
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Allow diiferrent users to access different ranges to input data

    Ok, here's the extra code to add.
    Press CTRL+F11
    Double click on "ThisWorkbook" in the left hand side of the screen, paste the code below in the white area that appears afterwards on the right.

    Please Login or Register  to view this content.
    What does this do and why is it necessary?
    This password protects all sheets (password: "excelforum.com" without the quotes) when the user closes the file.
    When the user opens the file, all sheets get unprotected again.
    This is necessary because if the user does NOT enable macros, your macro to force them to only edit their specific row would not work. They would be able to edit ANY row, until they say "enable macros".
    To prevent this, we protect all sheets upon closing the workbook and immediately after the workbook gets opened and the user allows macros, the protection is removed again.
    If they don't enable macros, the sheets stay protected (with them not being able to edit anything) until they enable macros.

    It's a small extra level of protection.

    Now - please remember to click that little star next to "add reputation" below, if you feel you've been helped adequately ;-)

  10. #10
    Registered User
    Join Date
    09-03-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Allow diiferrent users to access different ranges to input data

    Hi JasperD

    I have tried to include the additional codes in accordance with your latest post but I am not sure if my understanding is correct. I have therefore attached the actual excel file I am working on here for you to take a look for me to confirm what I have done is correct.

    The other thing that I am not sure of is the toggle on/off codes which I have not included in the workbook. I am not sure where to put these codes. Can you help me do that please. Also after inclusion of the toggle on/off codes, how do I activate it? Which key strokes to activate/deactivate the codes?

    Also the password “excelforum.com” in the worksheet protection code – when do I need to key this in?

    I can see the “Enable Macro” box sometimes comes on, and sometimes off – why is that?

    The purpose of the excel file:
    a. I will upload this file onto a network as a shared but protected excel file.
    b. I will toggle the code on to activate the excel file.
    c. Users will go in separately at different times to input data in the relevant row that corresponds to their user names before a given deadline.
    d. After the deadline, I will unshare the file.
    e. I will then need to toggle off the code, to make any necessary changes to the file, e.g. adding new users and deleting users who are no longer in the list.
    f. Then toggle on the file again.

    My apologies for being such a basic excel user with so little macro knowledge but I really appreciate your help in this, without which I would not have known how to proceed. Much thanks, JasperD.
    Attached Files Attached Files

+ 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. multi user, userform data can we store in access db on a realtime with 4 or 5 users
    By sagar.rajula in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2013, 07:12 AM
  2. Need Help Please In restricting access to users in Access 2010
    By Sharath_rk in forum Access Tables & Databases
    Replies: 5
    Last Post: 02-01-2013, 09:05 AM
  3. Replies: 2
    Last Post: 06-05-2012, 11:25 PM
  4. Restricting the number of cells users can input data to
    By LittleEm in forum Excel General
    Replies: 7
    Last Post: 11-30-2006, 05:11 AM
  5. Replies: 1
    Last Post: 11-09-2005, 06:40 PM

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