copy and paste from and to protected sheets

  • Thread starter Thread starter Tonso
  • Start date Start date
T

Tonso

i have a file with many sheets, all protected. i want select cells in
one protected sheet, go to another protected sheet, select a cell, then
havea a macro unprotect the sheet, paste the cells, then protect the
sheet again.
thanks,

Tonso
 
A couple of possibilities. One would be to change the nature of the sheet
protection to UserInterfaceOnly at which point code can modify the sheet, but
not the user. That being said here is some code for protecting and
unprotecting all ot the sheets. Put this in it's own seperate module...

Option Explicit
Option Private Module

Private Const m_cModule As String = "modProtectUnprotect"
Private Const m_cPassword As String = "MyPassword"

Public Sub ProtectAll()
Dim wks As Worksheet

For Each wks In Worksheets
On Error Resume Next
wks.Protect Password:=m_cPassword ', UserInterfaceOnly:=True
Next wks
End Sub

Public Sub UnProtectAll()
Dim wks As Worksheet

For Each wks In Worksheets
On Error Resume Next
wks.UnProtect Password:=m_cPassword
Next wks
End Sub
 
Back
Top