Protected Stock sheet in Excel

Hi Everyone,

Will try and keep this short.  I work for a multi site company, split into 6 separate divisions, at the end of the month a stock sheet is filled out in excel, this is comprised of the amount of finished/raw/w-i-p stock for each division and is a shared spreadsheet.

All the figures are then transferred into a summary sheet, the problem at the moment is that users are going into there division as and when they want to change there stock figures.

Does anybody have a better idea of doing this?  Is there a way of assigning a button which would look the sheet after the user has inputted the figures?

Any help with this would be greatly appreciated.
choy77Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

choy77Author Commented:
I meant to say *lock not *look
0
wshark83Commented:
here's a way in which you can lock the workbook after certain 30 days...but can easily be modified to lock after submission:

Private Sub Workbook_Open()
    'Range "DateCheck" Is a named cell on XlVeryHiden Sheet.
    If Range("TimeCheck") <> vbNullString Then 'Date has been set.
    'Check date.
    If Range("TimeCheck") < Date - 30 Then 'Expired
    'Your password Code HERE
End If
Else 'Set first Open date
    Range("TimeCheck") = Date
    Me.Save
End If
End Sub

or

This little macro will lock cells B1:B10 when the file is opened if the date
in A1 is more than 2 days earlier than today's date. This macro must be
placed in the workbook module.

Private Sub Workbook_Open()
With Sheets("TheSheetName")
If Date - .Range("A1") > 2 Then
.Range("B1:B10").Locked = True
End If
End With
End Sub
0
choy77Author Commented:
Hi wshark83,

thanks for the info.  How would I assign VB to a button, meaning after the user has inputted there figures, they would then click the button to say its complete and maybe flag up in the summary sheet as complete?

The only way the sheet can be unlocked is with a password?  I hope this makes sense, thanks very much for your help.  It doesnt have to be a sheet which is locked, the button could just lock a portion of cells instead?

Again Thanks.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

choy77Author Commented:
P.s.....I am not the most advanced user within excel, I would be most grateful ig you could provide an example spreadsheet :)
0
wshark83Commented:
no probs...

to create a button its easy you can just go to --> view --> toolbars --> Forms and then in the toolbar next to xyz there is grey button which created the button. Select this and then drag and daw the button in an area and it will automatically ask you to assign a macro.

here's a file which does things a bit differently...it protects the whole file from being editited...

also if you want to add password then simply add this line:

ThisWorkbook.Worksheets("Sheet1").Protect Password:="<yourpassword>"
Sample.xls
0
choy77Author Commented:
Hi,

This isn't really how i wanted it, I wanted a summary sheet which would always be locked but would allow the admin to unlock it with a password using a button.  I wanted the other tabs on the sheet to be able to be locked by the user when they have inputted all there data, this can only be locked by the admin person.

I basically want a full workbook with user privileges where only one person can unlock certain things.  I would also like to display a time and date of when the other sheets were locked in the summary page?  Is this possible?  Thanks very much
0
wshark83Commented:
ok here you go...i think i've understood you correctly....

you just need to add the vba in specific tabs --> see attached example
Sample-Password-Control.xls
0
choy77Author Commented:
Hi yes this is similar to what I'm asking for thanks.

Please see attached a sample of what i would like, any help would be greatly appreciated.  Really the sheet should only need one master password, although a password for each division button would be good.  Please let me know if you require any further information
Book1.xlsx
0
wshark83Commented:
ok i've amended the attached file to meet your requirements...

although there is a flaw or i may have missed something as to how you plan to protect the summary tab ... without this you cannot unlock it....

therefore i've added lock summary button which you can use to enter a password to lock the summary tab....which is hardcode in the vba....

so will need to update all instances of this line...

mypass= "testing" to your desired password

regarding the button text unfortunately you cannot change the text with vba so its best to have a cell with the status as you have it now or have 2 buttons one for lock and another for unlock

also as a VBA Excel user you may want to protect your code so that nobody may modify it and to protect against the loss of intellectual property if people access source code without permission. This is easily achieved in the VBE editor by going to "Tools/VBAProject Properties/Protection". Check the box and enter a password.
Macro-Enabled-File.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
choy77Author Commented:
Hi,

Thanks very much for this, really appreciate it.  One thing I noticed is thast if I click the button again to lock a division sheet from the summary it doesnt allow it to.  Would this be better doing it through another button?  Please advise.
0
wshark83Commented:
once you have locked the sheet you can not lock it again....without unlocking it.....

if the solution works then can you please accept the answer and allocate points...
0
choy77Author Commented:
Thanks very much....work well.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.