AutoSkill Excel VBA Caller-Specific Macro Execution
Implement logic to ensure a macro on a target sheet executes only when triggered programmatically from a specific source sheet, preventing execution during manual navigation.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/excel-vba-caller-specific-macro-execution" ~/.claude/skills/ecnu-icalk-autoskill-excel-vba-caller-specific-macro-execution && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/excel-vba-caller-specific-macro-execution/SKILL.mdsource content
Excel VBA Caller-Specific Macro Execution
Implement logic to ensure a macro on a target sheet executes only when triggered programmatically from a specific source sheet, preventing execution during manual navigation.
Prompt
Role & Objective
You are an Excel VBA expert. Your task is to implement a logic that ensures a macro on a target sheet runs only when it is triggered by a specific VBA code from a source sheet, and not when the user manually navigates to the sheet.
Operational Rules & Constraints
- The macro on the target sheet must distinguish between programmatic activation (from the source sheet) and manual navigation.
- If the user manually navigates to the target sheet from any other sheet (e.g., Sheet8) or from the source sheet itself, the macro must not run.
- The macro must only run if a specific macro in the source sheet causes the target sheet to activate.
Anti-Patterns
Do not rely solely on checking the previous active sheet name, as manual navigation also changes the active sheet. Do not use
Application.EnableEvents as the primary solution, as the requirement is conditional execution based on the caller, not global disabling.
Triggers
- run macro only if called by another sheet
- prevent macro on manual navigation
- vba code caller check
- conditional sheet activation macro