+ Reply to Thread
Results 1 to 10 of 10

Protecting Sheet to Prevent Viewing At All

Hybrid View

  1. #1
    Michael Link
    Guest

    Protecting Sheet to Prevent Viewing At All

    Is it possible to protect a sheet in a workbook so that it isn't even
    viewable unless you have the password? One of the sheets in my workbook
    contaiins highly sensitive information that I don't want most folks to see,
    but I want users to be continue to hide and unhide other elements in the
    workbook to fit their needs.

    Is there something I can write in VBA that will do the trick? In the perfect
    world, what would happen is that, when a user clicked on the tab for the
    Sensitive Sheet, a popup box would appear asking for a password. Is this even
    possible?

    Help! Any answers would be much appreciated.

    Cheers!



  2. #2
    VoG
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    The following code will make the sheet 'invisible' to ordinary users:

    Sub hideit()
    Sheets("Sheet2").Visible = xlVeryHidden
    End Sub

    To unhide it use

    Sub unhideit()
    Sheets("Sheet2").Visible = True
    End Sub


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...excel/200507/1

  3. #3
    Michael Link
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    Both this and the other reply, below, will be phenomenally useful. Thank you
    both! The Excel rescue team comes through again!

    "VoG" wrote:

    > The following code will make the sheet 'invisible' to ordinary users:
    >
    > Sub hideit()
    > Sheets("Sheet2").Visible = xlVeryHidden
    > End Sub
    >
    > To unhide it use
    >
    > Sub unhideit()
    > Sheets("Sheet2").Visible = True
    > End Sub
    >
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...excel/200507/1
    >


  4. #4
    Hayeso
    Guest

    RE: Protecting Sheet to Prevent Viewing At All

    Right Click the Sheet tab and select "View Code" then add
    the following code. You can change the password to whatever you like.


    Private Const Password As String = "DoubleOhSeven"

    Private Sub Worksheet_Activate()
    Me.Visible = False
    If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    "Enter Password") <> Password Then
    Me.Visible = False
    Else
    Me.Visible = True
    End If
    End Sub


    "Michael Link" wrote:

    > Is it possible to protect a sheet in a workbook so that it isn't even
    > viewable unless you have the password? One of the sheets in my workbook
    > contaiins highly sensitive information that I don't want most folks to see,
    > but I want users to be continue to hide and unhide other elements in the
    > workbook to fit their needs.
    >
    > Is there something I can write in VBA that will do the trick? In the perfect
    > world, what would happen is that, when a user clicked on the tab for the
    > Sensitive Sheet, a popup box would appear asking for a password. Is this even
    > possible?
    >
    > Help! Any answers would be much appreciated.
    >
    > Cheers!
    >
    >


  5. #5
    Michael Link
    Guest

    RE: Protecting Sheet to Prevent Viewing At All

    As Mr. Burns would say, EXCELLENT! This will be very helpful. Thank you so
    much!

    "Hayeso" wrote:

    > Right Click the Sheet tab and select "View Code" then add
    > the following code. You can change the password to whatever you like.
    >
    >
    > Private Const Password As String = "DoubleOhSeven"
    >
    > Private Sub Worksheet_Activate()
    > Me.Visible = False
    > If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    > "Enter Password") <> Password Then
    > Me.Visible = False
    > Else
    > Me.Visible = True
    > End If
    > End Sub
    >
    >
    > "Michael Link" wrote:
    >
    > > Is it possible to protect a sheet in a workbook so that it isn't even
    > > viewable unless you have the password? One of the sheets in my workbook
    > > contaiins highly sensitive information that I don't want most folks to see,
    > > but I want users to be continue to hide and unhide other elements in the
    > > workbook to fit their needs.
    > >
    > > Is there something I can write in VBA that will do the trick? In the perfect
    > > world, what would happen is that, when a user clicked on the tab for the
    > > Sensitive Sheet, a popup box would appear asking for a password. Is this even
    > > possible?
    > >
    > > Help! Any answers would be much appreciated.
    > >
    > > Cheers!
    > >
    > >


  6. #6
    Michael Link
    Guest

    RE: Protecting Sheet to Prevent Viewing At All

    Hi--

    Actually, I just had a few minutes to try to implement this. Unfortunately,
    I'm gettiing a "Syntax Error" message, indicating that there's an
    end-of-statement issue. Might you have any ideas what the issue is?

    Thanks!

    "Hayeso" wrote:

    > Right Click the Sheet tab and select "View Code" then add
    > the following code. You can change the password to whatever you like.
    >
    >
    > Private Const Password As String = "DoubleOhSeven"
    >
    > Private Sub Worksheet_Activate()
    > Me.Visible = False
    > If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    > "Enter Password") <> Password Then
    > Me.Visible = False
    > Else
    > Me.Visible = True
    > End If
    > End Sub
    >
    >
    > "Michael Link" wrote:
    >
    > > Is it possible to protect a sheet in a workbook so that it isn't even
    > > viewable unless you have the password? One of the sheets in my workbook
    > > contaiins highly sensitive information that I don't want most folks to see,
    > > but I want users to be continue to hide and unhide other elements in the
    > > workbook to fit their needs.
    > >
    > > Is there something I can write in VBA that will do the trick? In the perfect
    > > world, what would happen is that, when a user clicked on the tab for the
    > > Sensitive Sheet, a popup box would appear asking for a password. Is this even
    > > possible?
    > >
    > > Help! Any answers would be much appreciated.
    > >
    > > Cheers!
    > >
    > >


  7. #7
    Norman Jones
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    Hi Michael,

    one line of Hayeso's code has wrapped making it appear as two lines. To
    obviate the problem, replace:

    > If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    > "Enter Password") <> Password Then


    with:

    If InputBox("Please Enter the Password for the " _
    & Me.Name & " Sheet", "Enter Password") _
    <> Password Then

    ---
    Regards,
    Norman



    "Michael Link" <MichaelLink@discussions.microsoft.com> wrote in message
    news:1F99BB20-811D-4A1E-8318-7DE53CB6AE03@microsoft.com...
    > Hi--
    >
    > Actually, I just had a few minutes to try to implement this.
    > Unfortunately,
    > I'm gettiing a "Syntax Error" message, indicating that there's an
    > end-of-statement issue. Might you have any ideas what the issue is?
    >
    > Thanks!
    >
    > "Hayeso" wrote:
    >
    >> Right Click the Sheet tab and select "View Code" then add
    >> the following code. You can change the password to whatever you like.
    >>
    >>
    >> Private Const Password As String = "DoubleOhSeven"
    >>
    >> Private Sub Worksheet_Activate()
    >> Me.Visible = False
    >> If InputBox("Please Enter the Password for the " & Me.Name & "
    >> Sheet",
    >> "Enter Password") <> Password Then
    >> Me.Visible = False
    >> Else
    >> Me.Visible = True
    >> End If
    >> End Sub
    >>
    >>
    >> "Michael Link" wrote:
    >>
    >> > Is it possible to protect a sheet in a workbook so that it isn't even
    >> > viewable unless you have the password? One of the sheets in my workbook
    >> > contaiins highly sensitive information that I don't want most folks to
    >> > see,
    >> > but I want users to be continue to hide and unhide other elements in
    >> > the
    >> > workbook to fit their needs.
    >> >
    >> > Is there something I can write in VBA that will do the trick? In the
    >> > perfect
    >> > world, what would happen is that, when a user clicked on the tab for
    >> > the
    >> > Sensitive Sheet, a popup box would appear asking for a password. Is
    >> > this even
    >> > possible?
    >> >
    >> > Help! Any answers would be much appreciated.
    >> >
    >> > Cheers!
    >> >
    >> >




  8. #8
    coddave
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    Hi Norman,

    Thanks for the help! I also required some information to be restricted. Out
    of curiosity after unhiding the cell, how do you go in at a later time to
    change the password? When I click on the sheet it continues to bring the
    password screen up over and over. Is there a way to select on the tab and
    click view code again?

    Sincerely,

    Dave

    "Norman Jones" wrote:

    > Hi Michael,
    >
    > one line of Hayeso's code has wrapped making it appear as two lines. To
    > obviate the problem, replace:
    >
    > > If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    > > "Enter Password") <> Password Then

    >
    > with:
    >
    > If InputBox("Please Enter the Password for the " _
    > & Me.Name & " Sheet", "Enter Password") _
    > <> Password Then
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Michael Link" <MichaelLink@discussions.microsoft.com> wrote in message
    > news:1F99BB20-811D-4A1E-8318-7DE53CB6AE03@microsoft.com...
    > > Hi--
    > >
    > > Actually, I just had a few minutes to try to implement this.
    > > Unfortunately,
    > > I'm gettiing a "Syntax Error" message, indicating that there's an
    > > end-of-statement issue. Might you have any ideas what the issue is?
    > >
    > > Thanks!
    > >
    > > "Hayeso" wrote:
    > >
    > >> Right Click the Sheet tab and select "View Code" then add
    > >> the following code. You can change the password to whatever you like.
    > >>
    > >>
    > >> Private Const Password As String = "DoubleOhSeven"
    > >>
    > >> Private Sub Worksheet_Activate()
    > >> Me.Visible = False
    > >> If InputBox("Please Enter the Password for the " & Me.Name & "
    > >> Sheet",
    > >> "Enter Password") <> Password Then
    > >> Me.Visible = False
    > >> Else
    > >> Me.Visible = True
    > >> End If
    > >> End Sub
    > >>
    > >>
    > >> "Michael Link" wrote:
    > >>
    > >> > Is it possible to protect a sheet in a workbook so that it isn't even
    > >> > viewable unless you have the password? One of the sheets in my workbook
    > >> > contaiins highly sensitive information that I don't want most folks to
    > >> > see,
    > >> > but I want users to be continue to hide and unhide other elements in
    > >> > the
    > >> > workbook to fit their needs.
    > >> >
    > >> > Is there something I can write in VBA that will do the trick? In the
    > >> > perfect
    > >> > world, what would happen is that, when a user clicked on the tab for
    > >> > the
    > >> > Sensitive Sheet, a popup box would appear asking for a password. Is
    > >> > this even
    > >> > possible?
    > >> >
    > >> > Help! Any answers would be much appreciated.
    > >> >
    > >> > Cheers!
    > >> >
    > >> >

    >
    >
    >


  9. #9
    coddave
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    Don't worry I figured it out.

    Thanks anyways,

    Dave

    "coddave" wrote:

    > Hi Norman,
    >
    > Thanks for the help! I also required some information to be restricted. Out
    > of curiosity after unhiding the cell, how do you go in at a later time to
    > change the password? When I click on the sheet it continues to bring the
    > password screen up over and over. Is there a way to select on the tab and
    > click view code again?
    >
    > Sincerely,
    >
    > Dave
    >
    > "Norman Jones" wrote:
    >
    > > Hi Michael,
    > >
    > > one line of Hayeso's code has wrapped making it appear as two lines. To
    > > obviate the problem, replace:
    > >
    > > > If InputBox("Please Enter the Password for the " & Me.Name & " Sheet",
    > > > "Enter Password") <> Password Then

    > >
    > > with:
    > >
    > > If InputBox("Please Enter the Password for the " _
    > > & Me.Name & " Sheet", "Enter Password") _
    > > <> Password Then
    > >
    > > ---
    > > Regards,
    > > Norman
    > >
    > >
    > >
    > > "Michael Link" <MichaelLink@discussions.microsoft.com> wrote in message
    > > news:1F99BB20-811D-4A1E-8318-7DE53CB6AE03@microsoft.com...
    > > > Hi--
    > > >
    > > > Actually, I just had a few minutes to try to implement this.
    > > > Unfortunately,
    > > > I'm gettiing a "Syntax Error" message, indicating that there's an
    > > > end-of-statement issue. Might you have any ideas what the issue is?
    > > >
    > > > Thanks!
    > > >
    > > > "Hayeso" wrote:
    > > >
    > > >> Right Click the Sheet tab and select "View Code" then add
    > > >> the following code. You can change the password to whatever you like.
    > > >>
    > > >>
    > > >> Private Const Password As String = "DoubleOhSeven"
    > > >>
    > > >> Private Sub Worksheet_Activate()
    > > >> Me.Visible = False
    > > >> If InputBox("Please Enter the Password for the " & Me.Name & "
    > > >> Sheet",
    > > >> "Enter Password") <> Password Then
    > > >> Me.Visible = False
    > > >> Else
    > > >> Me.Visible = True
    > > >> End If
    > > >> End Sub
    > > >>
    > > >>
    > > >> "Michael Link" wrote:
    > > >>
    > > >> > Is it possible to protect a sheet in a workbook so that it isn't even
    > > >> > viewable unless you have the password? One of the sheets in my workbook
    > > >> > contaiins highly sensitive information that I don't want most folks to
    > > >> > see,
    > > >> > but I want users to be continue to hide and unhide other elements in
    > > >> > the
    > > >> > workbook to fit their needs.
    > > >> >
    > > >> > Is there something I can write in VBA that will do the trick? In the
    > > >> > perfect
    > > >> > world, what would happen is that, when a user clicked on the tab for
    > > >> > the
    > > >> > Sensitive Sheet, a popup box would appear asking for a password. Is
    > > >> > this even
    > > >> > possible?
    > > >> >
    > > >> > Help! Any answers would be much appreciated.
    > > >> >
    > > >> > Cheers!
    > > >> >
    > > >> >

    > >
    > >
    > >


  10. #10
    Dave Peterson
    Guest

    Re: Protecting Sheet to Prevent Viewing At All

    Worksheet and workbook protection (via tools|Protection) is very weak and isn't
    meant for security.

    I wouldn't share any highly sensitive data in excel.

    (If the user disables macros/events, then no macro solution will help.)

    And if a user can find this newsgroup or google, they can find ways to unprotect
    your workbook/worksheet.

    Be very careful with what you share in excel.

    Michael Link wrote:
    >
    > Is it possible to protect a sheet in a workbook so that it isn't even
    > viewable unless you have the password? One of the sheets in my workbook
    > contaiins highly sensitive information that I don't want most folks to see,
    > but I want users to be continue to hide and unhide other elements in the
    > workbook to fit their needs.
    >
    > Is there something I can write in VBA that will do the trick? In the perfect
    > world, what would happen is that, when a user clicked on the tab for the
    > Sensitive Sheet, a popup box would appear asking for a password. Is this even
    > possible?
    >
    > Help! Any answers would be much appreciated.
    >
    > Cheers!


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1