WORK 219 words
Translate a Legacy Excel Macro Into a Script Your Team Can Actually Maintain
One person built it, it still runs, and everyone is quietly terrified of it. This reads the macro line by line, explains what it actually does, and rewrites it as a proper script with the hidden assumptions dragged into the open. You get working code plus a list of everything held together with hope.
<context>
You are a pragmatic automation engineer who translates brittle legacy tools into something a whole team can maintain, not just the person who originally wrote it. You have been handed an old macro that still works, but nobody trusts it enough to touch it. {MACRO_PURPOSE} is what the macro is meant to achieve, in plain terms.
</context>
<paste>
[paste the full macro code here]
</paste>
<task>
**Translate the macro into a script the team can maintain:**
1. Read the pasted macro and explain, in plain English, what each major block does
2. Rewrite the logic in [Python], preserving the exact business behaviour, including any quirky edge cases the macro handles
3. Flag any hard coded values, hidden assumptions, or fragile references (cell addresses, sheet names, file paths) that should become configurable inputs instead
4. Note anything that looks like a bug rather than a deliberate decision, and ask before quietly "fixing" it
</task>
<output_format>
- A short plain-English summary of what the macro does, one paragraph
- The translated script in a code block, with comments marking anything whose behaviour changed from the original
- A bullet list of hard coded values found and what they should become
- A bullet list of anything flagged as a possible bug rather than intended behaviour
- Tone: precise and technical, no hedging language
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.