+ Reply to Thread
Results 1 to 4 of 4

How do I protect/unprotect macro buttons?

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2019
    Posts
    27

    Question How do I protect/unprotect macro buttons?

    In my first post (Password Controlled Cell Entry and Subsequent Actions), I asked for help in using VBA to control usernames and passwords via Excel buttons. The attached file is the most up-to-date version.

    As I need the macro buttons to control users and validate passwords, thus allowing staff to insert their signatures, everything is LIVE. When I have used sheet protection, the macros don't run. All the buttons are active, but I want to restrict the user to only the buttons that are applicable to them. I want to force them to click the right button(s), dependant on who they are and what they are doing.
    1. The "Float" sheet has to be populated with today's date, two float seal numbers and two office staff signatures.
    2. This sheet then needs to be opened by retail staff when the floats are inserted in the tills and numbers verified with two sets of signatures per till.
    3. At end of day, the tills are emptied and two seals numbers entered and numbers verified with two sets of retail staff signatures.
    4. The following day, the "Float" sheet becomes the "Cash" sheet and the cash out seals broken and numbers verified by two office staff.
    5. Data is then entered by one office staff and then checked by another office staff signed/co-signed accordingly.
    6. Money is banked, with banking seal already verified by office staff, and signed/co-signed accordingly.
    7. The completed form is then printed and filed with appropriate receipts.
    8. Finally, the "Cash" sheet is copied to become the "Float" sheet and data cleared apart from required data shown in step 1. The sequence then repeats ad infinitum!

    I've not got the above procedures in place yet but that's the aim. The main thing is making sure that the sequence is followed and protected against inadvertent errors.

    Your help would be greatly appreciated.

    Many thanks in advance, especially to royUK for his sterling assistance thus far.

    BTW: Enter "Manager" for User name and "m4nag3r" for the password when the workbook opens. This gives you full access/control.

    Cheers, DrEcosse
    Attached Files Attached Files
    Last edited by DrEcosse; 06-12-2012 at 11:37 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How do I protect/unprotect macro buttons?

    You can't protect the buttons. You need to ask for the password before the code runs, it it is incorrect then cancel the code. You could use a message box or adapt the userform that I gave you
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2019
    Posts
    27

    Re: How do I protect/unprotect macro buttons?

    Hi Roy

    Thanks for the feedback.

    If I had used Command Buttons instead of shapes for running the macro would this have worked better, e.g. utilising "CommandButton1.Enabled = True" and "CommandButton1.Enabled = False" ? Is there not something similar available/adaptable for shapes, i.e. there are 16 buttons named Button_1 to Button_16? Alternatively, is it possible hide the shapes that are not applicable or present them differently to encourage selection?

    The sequence of events (1. to 8. above) is constant, so how do I best control input to ensure this, if I can't avoid having all the buttons available for selection?

    Cheers, DrEcosse
    Last edited by DrEcosse; 06-12-2012 at 06:06 PM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How do I protect/unprotect macro buttons?

    If you used ActiveX commandbuttons you could enable buttons based on who has logged on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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