VBA Macro Writer

General Productivitychatgpt-prompts-for-exceldescribe_the_automationsheet_namesrange

Step-by-step workflow descriptions produce accurate macros. Requiring error handling prevents macros that crash silently. The paste-ready format instruction saves setup time.

Prompt
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

{{describe_the_automation}}{{sheet_names}}{{range}}{{trigger}}{{step_1}}{{step_2}}{{step_3}}

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.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.