Pull data from password protected sheet without password

Zanatos1986

New Member
Joined
Apr 15, 2010
Messages
48
Hey guys,
So I have a sheet with sensitive information on it that cannot be viewed by everyone at our company, however this sheet is also used to update alot of things within the company on a daily basis.
I currently have two excel spreadsheets, one with all the important data that is password protected and another that pulls data from this sheet that everyone can access and update. Whenever I open the sheet everyone can access it updates by pulling data from the password protected sheet. When you do this it asks for the password. Is there anyway to get around this (autogenerate the password?) We can't turn off the password and we also can't give it out (otherwise it's pointless).
Any suggestions?

Thanks!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Zanatos1986,
There should be no reason you can't pull data from a protected sheet to another, using formulas or with vba, without having to address the password.

If you're doing something that requires un-protecting the sheet with vba then try something like:
Code:
Sheets("YourSheetName").Unprotect "YourPassword"
and then at the end of the code...
Code:
Sheets("YourSheetName").Protect "YourPassword"

Hope it helps. (If not then I don't understand...)
 
Upvote 0
I use the following:

Sub ProtectSheet(pwsSheet As Worksheet)
' Turn Protection back on.
If (Not (pwsSheet.ProtectContents)) Then
pwsSheet.Protect _
Password:=MyPassword, _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, _
AllowFiltering:=True
End If
End Sub ' ProtectSheet

Sub UnprotectSheet(pwsSheet As Worksheet)
If (pwsSheet.ProtectContents) Then
pwsSheet.Unprotect Password:=MyPassword
End If
End Sub ' UnprotectSheet
 
Upvote 0
For that to work I believe you'll need quotes (" ") around "MyPassword".
I can see the convenience of unprotecting the sheet without having to enter the password but you basically remove any (already lightweight) security offered by the password to begin with if you're using the code to unprotect so people can edit, then again to reprotect.

I still wonder why you wouldn't be able to get your data without unprotecting.

Is your code not working? Where is it hung up when you hit debug?
 
Upvote 0
Half:

Three points. First, MyPassword is a string constant that I store in a separate Module that holds all Global variables. Second, I don't allow the users to unprotect the sheet for editing. I use a form that they enter data on and then I unprotect the sheet, make the changes, and reprotect the sheet without the user touching the actual worksheet. Third, I also password protect the VBA code so the user is unable to find out the password without some heavy-duty knowledge.

Hope that clears things up.
--Doug.
 
Upvote 0

Forum statistics

Threads
1,214,569
Messages
6,120,286
Members
448,953
Latest member
Dutchie_1

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