ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Protect/Unprotect workbook (https://www.excelbanter.com/excel-discussion-misc-queries/228907-protect-unprotect-workbook.html)

Vitordf

Protect/Unprotect workbook
 
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

Mike H

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


Dave Peterson

Protect/Unprotect workbook
 
Check your other post.

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


--

Dave Peterson


All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com