#1   Report Post  
Becca
 
Posts: n/a
Default macros

I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?
  #2   Report Post  
ufo_pilot
 
Posts: n/a
Default macros

If the sheet can be invisibe, then you can use this:

Format Sheet Hide

Tools Protection Protect workbook


"Becca" wrote:

I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?

  #3   Report Post  
Becca
 
Posts: n/a
Default macros

this seems a lengthy way to do it. is there not an easier way rather than
having to keep un-hiding the sheets?

"ufo_pilot" wrote:

If the sheet can be invisibe, then you can use this:

Format Sheet Hide

Tools Protection Protect workbook


"Becca" wrote:

I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?

  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default macros

Here is some code. It is at best basic

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ans
Dim sh2 As Worksheet
Application.EnableEvents = False
If ActiveSheet.Name < "Sheet1" Then
Set sh2 = ActiveSheet
Sh.Activate
Application.ScreenUpdating = False
ans = Application.InputBox("Supply password")
If ans < False Then
If ans = "password" Then
sh2.Activate
End If
End If
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Becca" wrote in message
...
I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?



  #5   Report Post  
Becca
 
Posts: n/a
Default macros

thank you :)

"Bob Phillips" wrote:

Here is some code. It is at best basic

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ans
Dim sh2 As Worksheet
Application.EnableEvents = False
If ActiveSheet.Name < "Sheet1" Then
Set sh2 = ActiveSheet
Sh.Activate
Application.ScreenUpdating = False
ans = Application.InputBox("Supply password")
If ans < False Then
If ans = "password" Then
sh2.Activate
End If
End If
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Becca" wrote in message
...
I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ams
 
Posts: n/a
Default macros

I have one question regarding this thread.
How can we protect one sheet with one password and different password for
other. For example, I have 4 excel sheets, I would like to give different
password for each. Lets say sheet1 is default active sheet. Now when I enter
password as "password" from your coding, I can open sheet2 and sheet3. But
how can i write code so that If I enter password as "pass" then only I can
open sheet3.

Other thing is, can we set one master password which can open all sheets at
a time. My requirement is: master password should open all sheets but there
should be different password for different sheet, so user who knows the
password for individual sheet can only open that individual sheet. Please
help me to do this.

Thank you.


"Bob Phillips" wrote:

Here is some code. It is at best basic

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ans
Dim sh2 As Worksheet
Application.EnableEvents = False
If ActiveSheet.Name < "Sheet1" Then
Set sh2 = ActiveSheet
Sh.Activate
Application.ScreenUpdating = False
ans = Application.InputBox("Supply password")
If ans < False Then
If ans = "password" Then
sh2.Activate
End If
End If
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Becca" wrote in message
...
I am trying to create a workbook where sheet 1 can be viewed by all but to
click on the other sheet tabs and open the sheet you need to enter a
password. any ideas?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect macros? JulieD Excel Discussion (Misc queries) 6 August 25th 05 08:38 PM
Purge macros Don_S Excel Worksheet Functions 1 August 16th 05 03:51 PM
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 10:57 PM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 12:21 AM
The available macros list in XL; how to suppress filename from showing KR Excel Discussion (Misc queries) 1 January 10th 05 07:20 PM


All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"