How to Automate Paste Special Values in Excel with VBA
Question details
The user wants to automatically convert formula results into static values for recently populated rows in Excel immediately after data is entered.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Streamlining data entry where calculations need to be permanently fixed as values once a specific row's data is filled in.
- Observed behavior
- Formulas currently remain active and dynamic. The goal is to trigger an automated process to paste them as values based on new input, rather than doing it manually.
Before applying VBA scripts to automate your data entry, create a backup copy of your workbook. Macros that overwrite formulas with values permanently clear the undo history, meaning you cannot revert the changes using standard undo shortcuts.
Use a Worksheet_Change Event Macro
Automate the conversion of formulas to values by triggering a macro whenever specific input columns are modified and are not blank.
A Worksheet_Change event in VBA monitors your worksheet for any edits. By specifying a target range, you can instruct Excel to automatically replace formulas with their calculated values as soon as new data is entered into the relevant cells.
Press Alt + F11 to launch the Visual Basic for Applications (VBA) editor in Excel.
In the Project Explorer panel on the left, double-click the specific worksheet (e.g., Sheet1) where you want the automation to take place.
From the left drop-down menu at the top of the code window, select 'Worksheet'. From the right drop-down menu, select 'Change'. This generates the Private Sub Worksheet_Change(ByVal Target As Range) block.
Write an IF statement to check if the Target.Column matches your input column and if Target.Value is not empty. Inside the IF statement, specify your formula range and use the code snippet 'Range.Value = Range.Value' to convert the formula to a static value.
Close the VBA editor and save your workbook as an Excel Macro-Enabled Workbook (.xlsm) to ensure the code remains active.

Trigger Conversion Using a 'Completed' Status Column
For safer execution, trigger the Paste Special Values macro only when a specific column is explicitly marked as 'Completed'.
Automate Macros and Data Entry in WPS Spreadsheet
WPS Spreadsheet provides robust support for VBA and Macros, allowing you to seamlessly automate repetitive tasks like converting formulas to values. With a highly familiar interface, you can write, test, and execute Worksheet_Change events effortlessly.
- 1. Install WPS Office: Download and install WPS Office, then open your macro-enabled workbook.
- 2. Access the Developer Tab: Navigate to the 'Developer' tab on the ribbon and click 'Visual Basic' to open the VBA Editor.
- 3. Insert Your Code: Double-click your desired sheet and paste your Worksheet_Change event code just as you would in Microsoft Excel.
- 4. Run and Save: Test your automated data entry and save the file in the compatible .xlsm format.

Frequently Asked Questions
Can I undo a VBA macro that pastes values?
No, running a VBA macro clears the Excel undo history. Any formula converted to a value through VBA cannot be reverted using the Ctrl+Z shortcut. It is highly recommended to test macros on a backup file before applying them to your main dataset.
Why isn't my Worksheet_Change event firing?
Ensure that Macros are enabled in your Trust Center settings. Additionally, check that 'Application.EnableEvents' hasn't been accidentally set to 'False' during a previous macro failure. You can reset it by typing 'Application.EnableEvents = True' in the Immediate Window of the VBA editor.
Is there a way to convert formulas to values without VBA?
Yes. You can manually highlight the cells containing the formulas, copy them (Ctrl+C), right-click, and select 'Paste Special' > 'Values'. While this avoids VBA entirely, it requires manual action every time new data is entered.
Will converting formulas to values reduce Excel file size?
Yes, if you have thousands of complex formulas recalculating constantly, converting them to static values can significantly reduce file size and improve the workbook's calculation speed and performance.




