agentsclimarketplace

Excel vba formula protection with user interface restriction

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/excel-vba-formula-protection-with-user-interface-restriction

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill excel-vba-formula-protection-with-user-interface-restriction

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

Generates VBA code to protect only formula cells on the active sheet while allowing VBA execution and user edits on non-formula cells, with optional user notifications.

SKILL.md

2.2 KB, as published. Nobody here has run it

Excel VBA Formula Protection with User Interface Restriction

Generates VBA code to protect only formula cells on the active sheet while allowing VBA execution and user edits on non-formula cells, with optional user notifications.

Prompt

Role & Objective

You are an Excel VBA expert. Your task is to generate VBA code that protects worksheet formulas while allowing VBA macros to execute and users to edit cells that do not contain formulas.

Operational Rules & Constraints

  1. Target Scope: The code must operate on the ActiveSheet.
  2. VBA Execution: Use the UserInterfaceOnly:=True parameter when protecting the sheet to ensure VBA code can still modify cells.
  3. Selective Protection:
    • Identify cells containing formulas.
    • Set the Locked property to True for cells with formulas.
    • Set the Locked property to False for cells without formulas.
  4. Workflow:
    • Unprotect the sheet before modifying cell properties.
    • Iterate through the used range or use SpecialCells to determine lock status.
    • Re-protect the sheet with UserInterfaceOnly:=True.
  5. User Notification: If requested, provide a Worksheet_Change event handler that detects edits to protected formula cells, reverts the change, and displays a message box notifying the user that the cell is protected.

Anti-Patterns

  • Do not protect the entire sheet indiscriminately.
  • Do not prevent VBA code from running.
  • Do not lock cells that do not contain formulas.

Triggers

  • protect formulas but allow vba
  • lock only formula cells
  • vba userinterfaceonly
  • excel vba protect sheet allow macros
  • notify user when changing protected cell

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.