Fix Excel Data Validation Breaks After Saving a Long VBA List
Question details
The user needs to prevent Excel from triggering a repair error and stripping data validation, conditional formatting, and column widths when a VBA-generated comma-separated validation list exceeds about 250 characters.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A VBA macro builds a comma-separated data validation list from worksheet values and places the long string directly in Formula1.
- Observed behavior
- The list works while the workbook is open, but after saving, closing, and reopening, Excel repairs the file and removes data validation, conditional formatting, and column-width settings.
Make a copy of the workbook before editing the VBA or validation settings, and identify the macro line that sets Formula1 to the long comma-separated string.
Replace the long Formula1 list with a worksheet range or named range
Use this when the validation source string exceeds about 250 characters and causes a repair prompt after reopening.
Putting a long comma-separated list directly in Formula1 makes the workbook vulnerable to Excel's data validation length limits. Storing the same items in worksheet cells and pointing the validation source to a named range keeps the dropdown intact without relying on one oversized string.
Enter each validation item in a separate cell in a single column, such as Sheet2!A1:A20, and keep the list range covered by the full set of items.
Select the list cells, click Formulas > Name Manager > New, enter the name MyValidationList, and click OK.
Open the VBA editor with Alt+F11, find the Validation.Add statement, and change Formula1 from the long comma-separated string to =MyValidationList.
Run the macro, save the workbook, close it, and reopen it to confirm that Excel no longer shows the repair dialog or removes formatting.

Isolate the issue with a new workbook and Excel Safe Mode
Use this to determine whether the repair error is specific to the current workbook or caused by an add-in.
Update or repair Office and confirm the exact build
Use this when the problem persists across workbooks or appears only on a specific Excel installation.
Use WPS Office as a Free Alternative for Stable Spreadsheet Validation
If Excel VBA keeps triggering repair errors with long inline validation lists, WPS Office offers a free, lightweight spreadsheet alternative with familiar menus, Excel file compatibility, and stable data validation through worksheet ranges or named ranges.

Frequently Asked Questions
Why does Excel repair my workbook after I save a long VBA data validation list?
Excel can remove data validation, conditional formatting, and column widths when a comma-separated validation source placed directly in Formula1 exceeds roughly 250 characters. The repair happens on reopen because the file contains an oversized inline validation list.
What is the maximum length for a comma-separated data validation list in Excel?
A direct comma-separated Formula1 string is typically limited to about 250 characters. Instead of using a long inline string, put the items in worksheet cells or a named range and reference that range.
How do I change VBA code to use a named range for data validation?
Create the list in worksheet cells, select it, and define a name such as MyValidationList from Formulas > Name Manager. In the VBA Validation.Add statement, set Formula1 to =MyValidationList instead of the long comma-separated string.
Can WPS Office open an Excel workbook with VBA data validation?
Yes. WPS Office supports Excel workbooks and can use worksheet ranges or named ranges for data validation dropdowns, giving you a free and lightweight way to avoid this Excel-specific repair issue.
What should I do if the repair error continues after using a named range?
Test the macro in a new workbook, start Excel in Safe Mode to rule out add-ins, install Office updates, run an Office repair, and note the exact Excel build. If it persists, contact Microsoft programming support because the issue is VBA and workbook-specific.




