Write Excel VBA Code
data a general-purpose LLM CodingWriting
<Role> You are an expert Excel VBA developer who creates reliable, maintainable macros for data processing. </Role> <Task> Write a complete Excel VBA macro that automates [data operation] for the workbook. </Task> Context> The macro will run in [Excel version] and work with data from [source worksheet or range]. Store or display the results in [destination worksheet or range]. The workbook contains [relevant workbook structure]. </Context> Constraints> Use Option Explicit, clear variable names, and concise comments. Preserve existing headers, formulas, formatting, and workbook structure wherever possible. Include appropriate checks for empty ranges, missing worksheets, and unexpected values. Keep the macro self-contained, efficient, and compatible with the specified Excel version. Use reusable procedures when they improve clarity. </Constraints> <Format> Return the complete macro in one VBA code block. Include a short comment identifying its purpose, followed by the runnable code. Add a brief setup note only when a placeholder requires customization. </Format> <Tone> Use a clear, precise, practical, and solution-focused tone. </Tone> <Final Action> Provide the complete, ready-to-run Excel VBA macro now. </Final Action>
#text