Password to unhide worksheets

kyceeq

New Member
Joined
Aug 24, 2023
Messages
8
Office Version
  1. 2021
Platform
  1. Windows
Hello everyone, please i have hit a deadend. I created two userforms for users to register and log into an excel workbook respectiveky. When the users register on the registration form, the details on the forms are saved on a worksheet that is hidden from all users except the Admin.
The users are also able to log in using the login form. The login form reads the information on the registration worksheet to give users access. Now i want a situation where these users(after log in), can view only certain worksheets based on the entries from the registration worksheet. For example, if the user's name is listed on the registration form under the heading 'Italian', as soon as he or she logs in, the sheet italian should unhide.

Please how do i go about this?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
thank you for your swift response. But the resource you shared didnt help. So maybe I'll explain better what i asking for please.

Screenshot (39)_115019.png

I have a dashboard that displays the name of the user and position. I want a situation where when C3 displays "Admin", all worksheets are unhidden. Then when it shows other positions like " Prenursery"

Screenshot (40)_115007.png

all worksheets not related to the title remain hidden while worksheets relating to the title are unhidden. For instance, "Prenursery broadsheet, Result all unhide.

Screenshot (42)_115017.png


Screenshot (41)_115016.png



This is the code I have written to hide all the worksheets .
Screenshot (43)_115018.png

I am new to VBA so I can't seem to go passed here...Looking forward to your help. thank you.
 
Upvote 0
I don't see why that link is not applicable to your issue. It is about hiding sheets based on a cell value and you want to hide sheets based on the value in C3.

Your first post only said what you wanted. It didn't say what you have tried. Now that I know you have something to work with I'll suggest you put a break point at the start and step through your code (F8) to see how your If statements are evaluated. It may be that neither IF evaluates how you expect. For example, in the second statement I do not see how it is likely that ws.Name can equal "DASHBOARD" and at the same time, (AND) equal what is in C3. Perhaps in one or both of those statements you need to use Or, not And.

I don't understand what user action it is that you want to trigger the code. You have that in a Selection Change event, which means that the user has to select a cell other than the active cell.

Also, you cannot hide all sheets at the same time. So if dashboard is already hidden that will raise an error. Perhaps that cannot happen. If it can, you'd need to first unhide it if it is hidden then do the rest.
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

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