Table of Contents
ChatGPT Prompt Structure
"Write an Excel VBA macro to [goal]. My data starts at line X up to line X (counting the headers) in the following order: [Paste your headers] The name of the sheet is [name]."
Example
"Write an Excel VBA macro to sort athletes by increasing age and create a bar chart: Athletes' Weight vs Sport. My data starts at line 3 up to line 376 (counting the headers) in the following order: Name Sport Nationality Age Wt kg Ht The name of the sheet is Sheet1."
ChatGPT will provide an Excel macro ready to use.
Steps
- Click “Copy code” to get the macro.
- Open Excel and go to the Developer tab. If it’s not visible, right-click the ribbon > Customize the Ribbon > Check Developer.
- Click on Macros, enter a name, and click Create.
- In the window, paste the VBA code provided by ChatGPT and run it using the play button at the top.