ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sheet tab Restriction (https://www.excelbanter.com/excel-discussion-misc-queries/68732-sheet-tab-restriction.html)

harpscardiff

Sheet tab Restriction
 

Hi,

Is there anyway to restrict someone from accessing a tab?

something like - if click on tab, then prompt box = password?:rolleyes:
:confused:

Thanks


--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960
View this thread: http://www.excelforum.com/showthread...hreadid=507189


Bob Phillips

Sheet tab Restriction
 
You could use Worksheet Activate, like so

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim pwd
Dim this As Worksheet
Dim wbState As Long
Set this = Sh
If ActiveSheet.Name = "Sheet2" Then
wbState = Windows(ThisWorkbook.Name).WindowState
Windows(ThisWorkbook.Name).WindowState = xlMinimized
pwd = InputBox("supply password")
If pwd < "password" Then
Application.EnableEvents = False
this.Activate
Application.EnableEvents = True
End If
Windows(ThisWorkbook.Name).WindowState = wbState
End If
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

Bob Phillips

(remove nothere from email address if mailing direct)

"harpscardiff"
wrote in message
news:harpscardiff.22jvry_1138797001.0109@excelforu m-nospam.com...

Hi,

Is there anyway to restrict someone from accessing a tab?

something like - if click on tab, then prompt box = password?:rolleyes:
:confused:

Thanks


--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile:

http://www.excelforum.com/member.php...o&userid=25960
View this thread: http://www.excelforum.com/showthread...hreadid=507189




harpscardiff

Sheet tab Restriction
 

thanks for your reply, i'll give it a go and let you know how I get on.

Thanks.


--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960
View this thread: http://www.excelforum.com/showthread...hreadid=507189



All times are GMT +1. The time now is 06:08 AM.

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