lockdown a workbook

  • Thread starter Thread starter AndyB
  • Start date Start date
A

AndyB

I have an Excel Workbook with many sheets and many many
lines of VBA Code to create live spreadsheets. Since the
cells are constantly changing to lock it down password
protect is limited. Once the sheets are protected live
update requires the cells to constantly unlock to change.
Any suggestions on locking it down so that the cells can
change via VB but not user manipulation in the cell
itself?
 
Andy,

A suggestion if I understand your question,

Sub ABC
ActiveSheet.Unprotect Password := "blaha"
'your code here
ActiveSheet.Protect Password := "blaha"
End Sub

You may want to read VBA Help on Protect, there are numerous options.

HTH
Anders Silven
 
Another way is to protect the sheet using code in your workbook_open event.

You can allow your macros to do more things than the user can.

Option Explicit
Private Sub Workbook_Open()
Dim wks As Worksheet
Set wks = Worksheets("sheet1")

With wks
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top