+ Reply to Thread
Results 1 to 2 of 2

Does protecting a workbook shut off VBA code?

  1. #1
    Stilla
    Guest

    Does protecting a workbook shut off VBA code?

    At this site, you guys helped me out on some code to automatically name tabs
    from an entry on the worksheets. Works great, thanks!

    When I protect the workbook, however, the code does not work. Did I do
    something wrong, or does this normaly happen?

    I have to protect the workbook for various reasons. Actually, that is why I
    needed the tabs to be named automatically.

    Any insights welcome!

  2. #2
    David D
    Guest

    RE: Does protecting a workbook shut off VBA code?

    When you protect a worksheet/workbook, even VBA becomes limited.

    For example, if a sheet is protected and you use VBA to add a row, you'll
    get a runtime error.

    You need to add code to your VBA routine that will unprotect the sheet, do
    its thing, and then protect it again.

    Sheets("whateverthename").UnProtect
    ....
    Sheets("whateverthename").Protect

    Hope that helps.

    --
    -David D


    "Stilla" wrote:

    > At this site, you guys helped me out on some code to automatically name tabs
    > from an entry on the worksheets. Works great, thanks!
    >
    > When I protect the workbook, however, the code does not work. Did I do
    > something wrong, or does this normaly happen?
    >
    > I have to protect the workbook for various reasons. Actually, that is why I
    > needed the tabs to be named automatically.
    >
    > Any insights welcome!


+ 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