I'd really like to be able to do this in worksheet, rather
than creating a workbook for each person.
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