View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Protect/Unprotect workbook

Hi,

Your question is a bit confusing you mention bot protecting and hiding
worksheets and I'm not sure which you want so here's a routine for each


To hide named sheets
Sub nn()
ShtData = "Sheet1,Sheet2" 'add sheet names as required
MySheet = Split(ShtData, ",")
For x = 0 To UBound(MySheet)
Sheets(MySheet(x)).Visible = False
Next
End Sub

to protect bamed sheets
Sub bb()
ShtData = "Sheet1,Sheet2" 'add sheet names as required
MySheet = Split(ShtData, ",")
For x = 0 To UBound(MySheet)
Sheets(MySheet(x)).Protect Password:="MyPass"
Next
End Sub

Mike


"Vitordf" wrote:

Hi,

My apologies if this is a repeat request, but I couldn't find any answers
for my dilema.

I can write the VB to protect the complete workbook, however I just want to
protect 4 out of ten worksheets, despite that all worksheets are hidden for
start bar 1 (Main).

I was wondering if there is anyone there which could help me.

Many Thanks in advance