Password Authentication

Status
Not open for further replies.

helplessnoobatexcel

New Member
Joined
Dec 15, 2023
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm a beginner at Excel VBA Macro coding and I know almost nothing about coding. I am tasked with creating a shared excel workbook in which users are only allowed to view & edit their respective sheets whilst I and a few others have access to view & edit all sheets. Currently, I have found a code online to do a user login and password in which it will bring the users to their designated sheets based on their login credentials. However, I am facing this error everytime I try to run this code and I have no idea how to debug it.. Thanks for your help in advance! ;)

Link of where I got the code from: Protecting Individual Worksheets, by User (Microsoft Excel)
 

Attachments

  • 1702882587112.png
    1702882587112.png
    15 KB · Views: 8
  • 1702882605728.png
    1702882605728.png
    20.6 KB · Views: 7

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Instead of
Rich (BB code):
Sheet1(sSName).Visible = True
it should be
Rich (BB code):
Sheets(sSName).Visible = True
and similar for the others.
 
Upvote 0
Instead of
Rich (BB code):
Sheet1(sSName).Visible = True
it should be
Rich (BB code):
Sheets(sSName).Visible = True
and similar for the others.
Hi Peter,
I have just tried this method, unfortunately it doesn't work and it presents me with a new error: of runtime error '9', stating that it is out of range and it is still the same line of code that has the error. Any idea on how I can rectify this?
 
Upvote 0
f runtime error '9', stating that it is out of range and it is still the same line of code that has the error.
I think that would mean that your variable sSName does not hold the name of one of your worksheets. When you get the error and click 'debug' hover over sSName and see what appears in the pop-up.
 
Upvote 0
I think that would mean that your variable sSName does not hold the name of one of your worksheets. When you get the error and click 'debug' hover over sSName and see what appears in the pop-up.
Hi Peter, thanks for your help! I followed your instructions and managed to rectify it. However...my code doesn't work at all... it only provides a user login, in which when keyed correctly, gives me access to the 1 sheet that has already been made visible in the workbook and I still cannot view other sheets. Any ideas on what I can possibly do?
 
Upvote 0
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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