View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Unhide sheets based on NT login

A simple way would be to have the control sheet structured as rows with

Login, 1st sheet, 2nd sheet, etc.

and then have code like this, assuming the NT Login is in UserName variable

Dim iRow As Long
Dim iCol As Long

On Error Resume Next
With Worksheets("Control")
iRow = Application.Match(UserName, .Range("A1:A100"), 0)
If iRow 0 Then
For iCol = 2 To .Cells(iRow, Columns.Count).End(xlToLeft).Column
Worksheets(.Cells(iRow, iCol).Value).Visible =
xlSheetVisible
Next iCol
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"MaxBrit " wrote in message
...
Hi

I have a workbook and would like to achieve the same as item below.
Also to have some users sheets unhidden but protected.

- "I have apps where another sheet, "control" always remains
very hidden. This sheet defines which of the hidden
sheets will be made visible to whichever user opens the
file....using the NT logon as the identity. If somebody
not on the list opens the file, then only the splash
sheet is visible. Patrick Molloy,Microsoft Excel MVP"-

Have found how to get the users logon name, but cannot see how to use
this to compare to the users permissions on a 'control' sheet.

Thanks for any advice.

Maxwell


---
Message posted from http://www.ExcelForum.com/