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: 11
  • 1702882605728.png
    1702882605728.png
    20.6 KB · Views: 10

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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