+ Reply to Thread
Results 1 to 2 of 2

Sheet Protection and VBA Code

  1. #1
    Forum Contributor
    Join Date
    05-26-2004
    Location
    Halifax, UK
    MS-Off Ver
    Office 2016
    Posts
    260

    Sheet Protection and VBA Code

    Does anyone know how to get Excel to allow VBA code to write to a password protected worksheet?

    I am using a work-around solution at the moment whereby the VBA unprotects the relevant worksheet, writes data to it, then re-protects it.

    There must be a better way than this though. Obviously I don't want my users to delete the formulas etc in the worksheet but I want my code to be able to write data to the worksheet without having to unprotect/re-protect it all the time!

    Thanks
    -Rob

  2. #2
    Jim Rech
    Guest

    Re: Sheet Protection and VBA Code

    One of the arguments of the Worksheet Protect method is UserInterfaceOnly.
    You should protect the sheet in code, setting that to true and see if it
    helps. It is not a setting that saves with the workbook so it has to be
    reset after each open.

    --
    Jim
    "TheRobsterUK" <[email protected]>
    wrote in message
    news:[email protected]...
    |
    | Does anyone know how to get Excel to allow VBA code to write to a
    | password protected worksheet?
    |
    | I am using a work-around solution at the moment whereby the VBA
    | unprotects the relevant worksheet, writes data to it, then re-protects
    | it.
    |
    | There must be a better way than this though. Obviously I don't want my
    | users to delete the formulas etc in the worksheet but I want my code to
    | be able to write data to the worksheet without having to
    | unprotect/re-protect it all the time!
    |
    | Thanks
    | -Rob
    |
    |
    | --
    | TheRobsterUK
    |
    |
    | ------------------------------------------------------------------------
    | TheRobsterUK's Profile:
    http://www.excelforum.com/member.php...fo&userid=9924
    | View this thread: http://www.excelforum.com/showthread...hreadid=374547
    |



+ 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