Need help with setting up password using inputbox

PresidentEvil

New Member
Joined
Jan 2, 2021
Messages
34
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hi,

I've recently made a MCQ test module that will help in preparing test papers with random questions from the question bank and conduct test and calculate the marks.

All of it has been coded and completed. Since this is MCQ test macro, there is a sheet named "Admin CP" that will do most of the work like generating questions, setting up timer, setting passing percentage etc.. This sheet will be hidden using another simple macro xlveryhidden. In order to unhide this sheet, I want to set up something where user inputs the password in Admin CP and then hide the worksheets.

If the admin wants to access this sheet again, he'll have to input the password which will be validated with the one that was setup earlier.

Below is the screenshot of the code that I've written. The "IF, Else, Then and =" doesn't seem to work. It either throws the warning message of incorrect password or unhides the sheets even if the password is incorrect.

Any help is highly appreciated. Thanks in advance.

 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi,
firstly, it's more helpful to forum if you post your code using code tags - MenuBar > VBA & place your code between them.

Have a look at this thread:Password Protected Sheets should be hidden until after password is enterred

that has couple of solutions for similar requirement that may be of help to you.

Dave
Thank you for the response. It's confidential information, so I cannot share the file or the code for it. But I have added a snapshot of the code where I was facing the issue. I managed to fix this one.

The inputbox values were in different subroutine which was causing this issue. Fixed it by having them both in one routine.
 
Upvote 0
Solution
Thank you for the response. It's confidential information, so I cannot share the file or the code for it. But I have added a snapshot of the code where I was facing the issue.

Unless you have hard coded personal data (not recommended), placing your code between code tags is no different from a confidential perspective than posting the screenshot you provided of the code. By placing code in code tags it gives those here that can help, the ability to quickly test & determine the issues with the code - forum would never ask for confidential data to be shared.

Anyway, glad you resolved

Dave
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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