Fix Excel VBA Error 1004 When Hiding Rows with a ComboBox
Question details
The user needs to hide worksheet rows with VBA without triggering an error caused by an ActiveX ComboBox list source.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A VBA macro hides rows that contain the A1:A10 list source for an ActiveX ComboBox.
- Observed behavior
- Excel displays run-time error 1004: Unable to set the Hidden property of the Range class.
Identify the rows your macro hides and check the ComboBox's ListFillRange in Developer > Design Mode > Properties. The steps below apply to an ActiveX ComboBox, not a Form Control.
Move the ComboBox list source to a helper range
Use a separate range that the macro does not hide, then point the ActiveX ComboBox to that range.
Copy the values from the current source, such as A1:A10, to a helper range that will remain visible, such as Helper!A1:A10 on a separate worksheet.
On the worksheet containing the ComboBox, select Developer > Design Mode. Right-click the ComboBox and choose Properties.
In the Properties window, replace the ListFillRange value with the helper range, for example Helper!A1:A10. Close the Properties window.
Turn off Developer > Design Mode, then run the row-hiding macro from Developer > Macros. Check that the target rows hide and show normally and that the ComboBox still displays its list.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Excel formats, making it easy to move everyday spreadsheet work. It does not fix Excel's ActiveX or VBA error; check macro and control compatibility before migrating a workbook that depends on them.

Frequently Asked Questions
Where can I find the ComboBox ListFillRange?
In Excel, select Developer > Design Mode, right-click the ActiveX ComboBox, and choose Properties. Look for ListFillRange in the Properties window.
Can the helper range be on another worksheet?
Yes. Copy the list values to a separate worksheet and enter a reference such as Helper!A1:A10 in ListFillRange. Make sure the macro does not hide the helper range's rows.
Why shouldn't I use On Error Resume Next to fix this error?
On Error Resume Next suppresses errors rather than resolving the conflict, and it can also conceal unrelated VBA problems. Move the ComboBox list source out of the rows being hidden instead.
What should I check if the error continues after moving the list source?
Reopen the ComboBox Properties and verify that ListFillRange points to the new range. Check the macro's row references and whether the worksheet is protected, then run the macro again from Developer > Macros.




