PDA

View Full Version : Help protecting sensitive data



JaviM
05-23-2011, 01:20 AM
Hi all,

I wonder if you can give a hand. I have a spreadsheet with sensitive data. It's fed by three people. I would like to protect the information already typed in using VBA, so every time that one of the users log in, go straight to the unprotected cells and type in what it's needed. I took the following approach but works partially.
Sub protectrange1()
Cells.Select
If Selection.Locked = False Then
Application.Goto Reference:="Contracts"
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
Else:
ActiveWorkbook.Unprotect
Selection.Locked = True
Application.Goto Reference:="Contracts"
Selection.FormulaHidden = False
ActiveSheet.protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
End If
ActiveWorkbook.Close
End Sub
Can you help me with this? Is there an easy way to do it? I am open to your suggestions

Bob Phillips
05-23-2011, 01:38 AM
It would help if you explained in what it partially works, what is right, what doesn't happen.

It would be even better if you could post an example workbook.