Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Granting permission to only view certain portions of a worksheet

42 views
Skip to first unread message

hlock

unread,
May 30, 2002, 1:51:39 PM5/30/02
to
Excel 2002:
I have one worksheet, located on a public drive, that
contains data pertaining to multiple users. I would like
to be able to allow users to view only their portion of
the worksheet. For example, user #1 opens the excel file
and is only able to see rows 36-92, but not any other
rows. Then, user #2 opens the file and views rows 93-115,
but not 36-92 or any other rows. I know that in Excel
2002, you can grant permission to specific users to edit a
set range, but I don't know about "viewing". Is this
possible?

I'd really like to be able to do this in worksheet, rather
than creating a workbook for each person.

Dave Peterson

unread,
May 30, 2002, 7:28:51 PM5/30/02
to
I just looked at the range protection in xl2002 and it looked like you're out of
luck that way.

As an alternative: Do you have something that you can use to determine who's
opening the file?

If you could use their network id (hard to falsify!). If you don't have that,
maybe you could just dole out a password and use something like this in the
workbook_open event:

Option Explicit

Private Sub Workbook_Open()

Worksheets("Instructions").Select

Application.ScreenUpdating = False

Dim myRows As String
Dim wks As Worksheet
Dim pwd As String

pwd = InputBox("who are you?", "Enter top secret code")

Select Case LCase(Trim(pwd))
Case Is = "#1": myRows = "13:96"
Case Is = "#2": myRows = "97:122"
Case Is = "#3": myRows = "123:144"
Case Else
MsgBox "You should not be viewing the workbook"
Application.ScreenUpdating = True
ThisWorkbook.Close savechanges:=False
Exit Sub
End Select

For Each wks In ThisWorkbook.Worksheets
With wks
If LCase(.Name) <> "instructions" Then
' .Unprotect Password:="secret"
.Protect Password:="secret", userinterfaceonly:=True
.UsedRange.Rows.Hidden = True
.Rows(myRows).Hidden = False
End If
End With
Next wks

Application.ScreenUpdating = True

End Sub


Take a look at scrollarea in the help. This is another option you could use.

--

Dave Peterson
ec3...@msn.com

0 new messages