+ Reply to Thread
Results 1 to 8 of 8

Protecting a Userform

  1. #1
    Registered User
    Join Date
    03-08-2018
    Location
    IL
    MS-Off Ver
    2013
    Posts
    5

    Protecting a Userform

    I have created a userform for data entry and would like to protect the data entered from the sheet so it forces the user to use the edit cmd button I have in place and be unable to delete rows or manually change data. Is there anyway to do this?

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,904

    Re: Protecting a Userform

    Have you tried protecting the worksheet ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    03-08-2018
    Location
    IL
    MS-Off Ver
    2013
    Posts
    5

    Re: Protecting a Userform

    Yes, protecting the worksheet gives runtime errors in VBA saying I need to unlock the sheet to make changes.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,904

    Re: Protecting a Userform

    Put
    Please Login or Register  to view this content.
    at the top of your code and
    Please Login or Register  to view this content.
    at the end of your code.

  5. #5
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    1,082

    Re: Protecting a Userform

    In workbook open using
    Sheets("name of sheet").protect "pas",userInterfaceonly := true
    "Dont Forget Click SOLVED_You can show your appreciation by clicking the Add Reputation * at the bottom left of any of their posts"

  6. #6
    Registered User
    Join Date
    03-08-2018
    Location
    IL
    MS-Off Ver
    2013
    Posts
    5
    Quote Originally Posted by daboho View Post
    In workbook open using
    Sheets("name of sheet").protect "pas",userInterfaceonly := true
    Thanks this worked but I added Workbook_Open() so it would run every time the ws is opened.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,904

    Re: Protecting a Userform

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  8. #8
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    1,082

    Re: Protecting a Userform

    Run in worksheet_activate

+ 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