As, due to the COVID-19 pandemic, the majority of my employer's employees are working from home, and with many employees, their leave cards for requesting annual leave are locked in their locker in the office, I've had to develop an electronic leave card so employees can still book leave. It's practically working just as I want, and we've been trialling it with my team for a few weeks. More teams now are wanting to use the form, and the only only issue, which thus far I've been ignoring, is that the page where the employee's manager authorises their leave is visible. With other teams coming on board now though, I want to try and nail the issue before they start using the forms now while I've only got 15 to update, rather than in a few weeks when I'd have to update many more!
The workbook has 5 worksheets: Leave, Configuration, Authorisation, List configuration, Changelog.
Employees have access to 'Leave' and 'Configuration'. At the bottom of the Leave sheet (out of the way where they're not likely to notice it), which is the sheet on which employees use to book leave there is a checkbox which hides/unhides the remaining three sheets. I didn't want to protect the sheets using Excel's built-in protection as it would rely on managers 'unlocking' the sheet to authorise leave and then remembering to re-protect the page(s) with the password after they'd finished. When a manager wants to authorise an employee's leave, they check the checkbox, and the Authorisation, List configuration, and Changelog pages unhide. Before they save and close the worksheet, they have to remember to un-check the checkbox.
Ideally what I need to do is to password protect the checkbox so that a password is needed to be able to use the checkbox, and then un-check the checkbox when the file is closed. I have a small piece of VBA, Module 1, which works the hide/unhide with the checkbox. There is a range on the Leave worksheet that gives the names of the worksheets. There is no other VBA in the workbook.
So, what I'm wanting the VBA to do is:
Is this do-able? (My VBA skills are at the level of follow instructions and copy and paste VBA where I'm told to, and change names etc. in the code. When I see it I can understand what it's doing, but I don't understand it well enough to write it myself)
This is the existing VBA that I'm using:
Is anyone able to help out at all?
Thanks, Bliss
The workbook has 5 worksheets: Leave, Configuration, Authorisation, List configuration, Changelog.
Employees have access to 'Leave' and 'Configuration'. At the bottom of the Leave sheet (out of the way where they're not likely to notice it), which is the sheet on which employees use to book leave there is a checkbox which hides/unhides the remaining three sheets. I didn't want to protect the sheets using Excel's built-in protection as it would rely on managers 'unlocking' the sheet to authorise leave and then remembering to re-protect the page(s) with the password after they'd finished. When a manager wants to authorise an employee's leave, they check the checkbox, and the Authorisation, List configuration, and Changelog pages unhide. Before they save and close the worksheet, they have to remember to un-check the checkbox.
Ideally what I need to do is to password protect the checkbox so that a password is needed to be able to use the checkbox, and then un-check the checkbox when the file is closed. I have a small piece of VBA, Module 1, which works the hide/unhide with the checkbox. There is a range on the Leave worksheet that gives the names of the worksheets. There is no other VBA in the workbook.
So, what I'm wanting the VBA to do is:
- Request a password if the checkbox is clicked
- If the correct password is given, 'unlock' the checkbox so it can be checked
- If the correct password isn't given, deny access to the checkbox and allow the user to try again
- When the user closes to workbook, uncheck the checkbox, and re-lock the checkbox
Is this do-able? (My VBA skills are at the level of follow instructions and copy and paste VBA where I'm told to, and change names etc. in the code. When I see it I can understand what it's doing, but I don't understand it well enough to write it myself)
This is the existing VBA that I'm using:
VBA Code:
Sub ShowHideWorksheets()
Dim Cell As Range
For Each Cell In Range("Q26:Q28")
ActiveWorkbook.Worksheets(Cell.Value).Visible = Not ActiveWorkbook.Worksheets(Cell.Value).Visible
Next Cell
End Sub
Is anyone able to help out at all?
Thanks, Bliss