Protecting a worksheet from veiwing but not from importing in data

J

Jimmy Ho

What is the best way to have a worksheet protected from
viewing but still allow users to transfer information from
a second worksheet into the protected one?

We have mutliple users that would save information into a
worksheet, but the viewing of the information contained in
the worksheet has to be limited to a select few. How can
this be done?

Thanks
 
G

Greg Wilson

The following code run from a code module will hide the specified sheet.
The user can't even tell it exists. To unhide substitute True in place
of xlVeryHidden. You can then lock the VBPoject to protect anyone from
running the code to unhide.

Transfer of information to the hidden worksheet can still be done by
code; e.g., a "Save" button that the user presses to store the data to
the hidden sheet. The button must invoke a macro that tells it to
transfer the data of course.

Sub HideSheet()
Sheets("Data").Visible = xlVeryHidden 'True to unhide
End Sub

Regards,
Greg
 
H

Harlan Grove

Greg Wilson said:
The following code run from a code module will hide the specified sheet.
The user can't even tell it exists. To unhide substitute True in place
of xlVeryHidden. You can then lock the VBPoject to protect anyone from
running the code to unhide.
....

Classic example of what's good enough to prevent unknowledgeable, innocent
users from sinding this worksheet vs preventing anyone who knows what s/he's
doing from stripping anything useful or interesting out of a file.

The following macro run from another workbook happily lists the names of all
very hidden worksheets in the target workbook security_test.xls.

Sub foo()
Dim x As Worksheet
For Each x In Workbooks("security_test.xls").Worksheets
If x.Visible = xlSheetVeryHidden Then _
MsgBox x.Name & Chr(13) & "is 'very hidden'"
Next x
End Sub

The INESCAPABLE point is (and seems to be repeated daily in one ng or
another): .XLS files ARE NOT SECURE! The best that the built-in security
features can do is prevent INADVERTENT tampering. Against determined
assault, Excel's security features are as sturdy as a house made out of wet
toilet paper.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top