+ Reply to Thread
Results 1 to 7 of 7

Code Protecting Sheets, Possible?

  1. #1
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183

    Question Code Protecting Sheets, Possible?

    Hello, I done a search regarding my topic, and didn't quite find any subjects on it. Maybe I didn't Phrase it correctly.

    Is it Possible to code protect a sheet (tab), before a user can open it?

    For example; I click on a hyperlink or directly on a tab to be opened, but
    before it opens, I would have to input a code. Is this Possible in Excel?
    If so, how?

    Thanks for any help on this, And Hello to you all..

  2. #2
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,881
    Something basic like this might work:

    Please Login or Register  to view this content.
    Change mypass to whatever you want to make your password. You can also change the focus of the Range in Sheet2 if you want. (For example, if you want them to go directly to cell E4, change Range("A2") to Range("E4").

    If you don't want them checking the vba code for the workbook to find out the password, simply protect it. In the vba window, click Tools-VBA Project Properties-Protection. Check the box for 'Lock project for viewing', type a password and click OK. Save the workbook, close it, then re-open it and your changes will have taken effect.

  3. #3
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183

    Thumbs up Thanks Alot

    Hey pjoaquin, This Is very Helpful! Thanks Alot!

    I have one issue. It appears when I try to use the Range ("XX"). Activate, I am
    getting a Visual Basic Error "400". Any Idea What this is? I put the "XX" just to
    represent a cell coordinance, I actually used ("D4").

    Also, running under a regular Module I get a runtime error "1004" - "Activate Method of Range class Failed"
    This is the line that is Marked as an error: Sheets("ACCTINFO").Range("D4").Activate

    Activating the sheets alone without a cell refernce is working very well..
    Thanks
    Last edited by Mhz; 02-24-2007 at 01:55 AM.

  4. #4
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,881
    I'm not sure why that error pops up. Anyone got an idea? Stupid coding on my part? (Probably)

    I tried again on mine, and it worked most of the time, and I got that a couple times. Nothing consistent every time though.

    Maybe one of the code jockeys can assist.

  5. #5
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183

    Thumbs up

    Thanks Pj, Just accessing the Sheets Is good Enough For Me Now..
    I'll keep checking into the Range Error... Thanks alot, You were a Big Help!

  6. #6
    Forum Moderator dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Mhz

    I have a template available which allows for this type of situation within Excel. You, as administrator, control the access rights and assign users' permission to view certain sheets on either a read / write or read only basis. Thus, the sheets a user can see on opening are determined by the administrator.

    If you would like to use this then send me a private message with your e-mail address. The file comes with full instructions.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  7. #7
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183
    Thanks dominicb, I did Private Maessage you,, Forgot to include my email
    But Re-sent it... Thanks Alot

+ 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