Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Limit access to certain worksheets (tabs)

Hi,

I have a excel file with 16 spreadsheets and I would like to limit access of
certain users to certain spreadsheets in the file. Is there any solution to
this?

Any help is much appreciated.

Thanks & Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Limit access to certain worksheets (tabs)

Hi,
this is possible. One way is to use the Workbook_Open &
Workbook_BeforeClose events. Use the Before_Close event to hide all the
sheets, and the Workbook_Open Event to show the sheets based on
username.... Something like this should start you off...this will show
sheets 1 to 5 (regardless of whether they are chart sheets or
worksheets) to John Doe..

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim intCnt As Integer
For intCnt = 1 To Me.Sheets.Count
Me.Sheets(intCnt).Visible = xlSheetVeryHidden
Next intCnt
End Sub


Private Sub Workbook_Open()
Dim strUser As String, intCnt As Integer

Let strUser = Environ("UserName")

Select Case strUser
Case "Doe, John"
Me.Sheets(Array(1,2,3,4,5)).Visible = xlSheetVisible
Case "Smith, John"
'''....etc...
Case Else

End Select
End Sub


Hth,
OJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Limit access to certain worksheets (tabs)

Perhaps I should mention that you need at least one sheet to be
visible.....this means my Workbook_BeforeClose code will error out....

For intCnt = 1 To Me.Sheets.Count should read
For intCnt = 2 To Me.Sheets.Count
where sheet 1 is a splash screen or something similar.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Limit access to certain worksheets (tabs)

Hide the ones you don't want them to see. In VBA, you can very hide them

Worksheets("Sensitive Data").Visible = xlVeryHidden

This stops them unhdining via the format menu.

--

HTH

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


"bayhe" wrote in message
...
Hi,

I have a excel file with 16 spreadsheets and I would like to limit access

of
certain users to certain spreadsheets in the file. Is there any solution

to
this?

Any help is much appreciated.

Thanks & Regards



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Limit access to certain worksheets (tabs)

you could use visible = xlveryhidden, you would have to write a sub,
that asked the user name, then set the worksheets to hidden or not.
shouldn'y be that hard.


Good Luck
ross
www.methodsinexcel.co.uk
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
Limit access to range of cells jvs Excel Worksheet Functions 1 November 10th 09 09:37 AM
Limit access in a pivot table Ken Excel Worksheet Functions 2 October 23rd 09 04:53 PM
Limit of # of tabs Dan S Excel Worksheet Functions 3 July 14th 05 11:46 PM
Limit access to certain worksheets (tabs) bayhe Excel Worksheet Functions 2 March 21st 05 06:08 PM
Limit access to certain worksheets (tabs) bayhe Excel Discussion (Misc queries) 2 March 21st 05 02:43 PM


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

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"