VBA & Macro Problems

How to Request More VBA Code from an AI Assistant in Spreadsheets

Chanuka GeekiyanageChanuka Geekiyanage Nov 10, 2026 869 views

Question details

The user wants to know how to prompt an AI assistant to provide an extended VBA code example, specifically a script that lists all formula cells within a worksheet.

How to Request More VBA Code from an AI Assistant
Product
Spreadsheet
Device & OS
not provided
Scenario
Interacting with an AI chatbot or assistant to generate a specific, advanced VBA macro for spreadsheet automation.
Observed behavior
The user needs the correct method to request expanded code, as no special buttons are provided in the AI interface, and a functioning VBA script to extract formula addresses.
Before you start

Ensure your workbook is saved as a Macro-Enabled Workbook (.xlsm) and identify exactly what task you want the AI to automate before writing your prompt.

Solution 1Recommended

Prompt the AI Assistant with Plain Language

AI assistants do not require special buttons or commands; you simply need to ask clearly for the expanded VBA code using natural language.

Modern AI assistants rely on conversational context. If the AI offers to provide an expanded version of a script, you can trigger the generation simply by confirming the request in plain English.

1
Open the AI chat

Navigate to the AI assistant interface you are using alongside your spreadsheet.

2
Type a direct request

Enter a clear follow-up prompt such as, "Yes, please provide the version that lists the addresses in a worksheet."

3
Copy the generated code

Once the AI generates the VBA script, locate the code block in the chat response and click the 'Copy' icon or highlight and press CTRL+C.

Prompt the AI Assistant with Plain Language
Example Output: The AI will typically provide a VBA procedure that loops through ActiveSheet.UsedRange, tests each cell with HasFormula, and writes the cell address and formula to a new worksheet.
Smart Spreadsheet Automation

Leverage WPS Office for Smarter Spreadsheet Automation

WPS Office integrates powerful AI capabilities directly into WPS Spreadsheet, allowing you to generate complex formulas, analyze data, and streamline repetitive tasks without needing extensive programming knowledge.

  1. 1. Install WPS Office: Download and install WPS Office, then open a new or existing workbook in WPS Spreadsheet.
  2. 2. Access Developer Tools: Enable the Developer tab to access the built-in VBA editor where you can paste your AI-generated macro scripts.
  3. 3. Utilize WPS AI: Click the WPS AI tab on the ribbon to launch the assistant for instant formula generation and data insights.
Built-in WPS AI to help write formulas and analyze data instantly using natural language.Seamless compatibility with Microsoft Excel VBA macros and .xlsm formats.Comprehensive developer tools for macro creation, editing, and execution.Lightweight, fast performance across Windows, Mac, and mobile platforms.
microsoft office alternative - wps office

Frequently Asked Questions

Can the AI assistant write a VBA macro entirely from scratch?

Yes. You do not need to start with existing code. Simply describe your exact requirements to the AI, such as "Write a VBA macro that highlights all cells containing formulas in yellow," and it will generate the complete script.

Do I need to know VBA programming to use AI-generated code?

You do not need to be an expert programmer, but having a basic understanding of how to open the VBA editor (ALT + F11), insert a module, and run the macro is necessary to apply the AI's output to your spreadsheet.

Why is my AI-generated VBA code giving a runtime error?

AI-generated code might reference worksheet names or cell ranges that do not exist in your specific file. Review the code to ensure that variables like 'ActiveSheet' or hardcoded sheet names match your workbook's actual structure.

How can I make the AI refine the VBA code it just provided?

If the code isn't exactly what you need, reply to the AI with specific adjustments. For example, say "Update this code to only check column C for formulas" and the AI will rewrite the script accordingly.