VBA Macro Writer
Step-by-step workflow descriptions produce accurate macros. Requiring error handling prevents macros that crash silently. The paste-ready format instruction saves setup time.
Write a VBA macro for Excel that does the following: **Task:** {{describe_the_automation}} **Sheet(s) involved:** {{sheet_names}} **Range:** {{range}} (e.g., "A1:D500" or "Column A, all rows with data") **Trigger:** {{trigger}} (e.g., "button click", "workbook open", "cell change") Step-by-step workflow: 1. {{step_1}} 2. {{step_2}} 3. {{step_3}} Requirements: - Include error handling (On Error GoTo) - Add comments explaining each section - Show a message box when complete with a summary - Handle the case where the sheet or range is empty Format the code so I can paste it directly into the VBA editor (Alt+F11 > Insert > Module).
Variables to customize
Why this prompt works
Step-by-step workflow descriptions produce accurate macros. Requiring error handling prevents macros that crash silently. The paste-ready format instruction saves setup time.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Forcing the agent to plan before acting prevents premature execution and wasted steps. Explicit dependency mapping enables parallel execution and catches logical gaps early.
Tool Selection AgentThe ReAct pattern (Reason + Act) creates an explicit reasoning trace that improves tool selection accuracy. The error-handling rule prevents infinite retry loops.
Prompt CompressorExplicitly requiring all functional requirements to be preserved prevents the model from over-compressing and losing critical instructions.
Memory Management AgentExplicit memory read/write instructions create agents that improve over time. Categorization keeps memories organized, and the deduplication rule prevents context bloat.