View Single Post
  #5   Report Post  
michael
 
Posts: n/a
Default Protection in Excel - how do i hide some info. from some users

thanks but this is not what i need, i need the users not to see in specific
columns and specific cells and othe need to see them. this is for DB that
some of the data in specific rows are restricted for some other users and the
other information in the row is not restricted, also the information in other
rows is not restricted in all the row. how can you help me with this.

"Peter Rooney" wrote:

Michael,

It really all depend on how secure you want your columns to be.

You could hide the columns with the following:

Columns("D:E").EntireColumn.Hidden = true

and use the opposite command to unhide them in the macro I gave you earlier:

Columns("D:E").EntireColumn.Hidden = false

But this doesn't stop a user from manually unhiding the columns.

To counteract this, you could hide the column headers thus:

ActiveWindow.DisplayHeadings = False

but this doesn't stop somebody from redisplaying them via Tools-Options-View!

To really go for it, you have to have a macro that runs as soon as you open
your workbook that hides the columns, then customizes the menu to remove the
"Tools" command!

Somthing like this, perhaps:

Private Sub Workbook_Open()
ScreenSetup '(this can be anything - it's just the name of a procedure
you call)
End Sub

This goes in the "ThisWorkBook" code sheet, with ScreenSetup containing all
the procedures you need to customise your worksheet.

You need to remember to reset all the Excel settings you've changed before
you close the workbook, with the following macro that also goes in the
ThisWorkBook code sheet.

Private Sub Workbook_BeforeClose(cancel As Boolean)
ScreenReset '(this too can be anything - it's just the name of your
procedure)
End Sub

Try recording yourself changing the display and menu to your requirements
and pasting the resulting code into the two macros above, and opening and
closing your workbook to see what happens.

Hope this helps

pete





"michael" wrote:

hi,

lets say i have a table o 5 coulmns:
A-E and i i have information in all the columns, but i whant that some of
the users will not be able to see the data in coulms D and E. how do i do
this.

"Peter Rooney" wrote:

Michael,

Try something like this:

Sub Password()

Message = "Enter Password"
Title = "Restricted User Mode"
DefaultPassword = "********"
ReturnedPassword = UCase(InputBox(Message, Title, DefaultPassword))

If ReturnedPassword < "MyPassword" Then
Exit Sub
Else
'Unprotect your ranges etc
End If

End Sub

On;y the prople who know "Mypassword" will be able to reveal the hidden
renges, columns, rows etc.

Hope this helps

Pete

"michael" wrote:

I need to protect a workbook that will hide some of the information from
several users but will show this information to other users. it is very urgent