VBA & Macro Problems

Fix Excel VBA Error 1004 When Hiding Rows with a ComboBox

Bushra ParveenBushra Parveen Nov 18, 2026 869 views

Question details

The user needs to hide worksheet rows with VBA without triggering an error caused by an ActiveX ComboBox list source.

Fix Excel VBA Error 1004 When Hiding Rows with a ComboBox
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.
Before you start

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.

Solution 1Recommended

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.

1
Copy the list values

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.

2
Open the control properties

On the worksheet containing the ComboBox, select Developer > Design Mode. Right-click the ComboBox and choose Properties.

3
Change ListFillRange

In the Properties window, replace the ListFillRange value with the helper range, for example Helper!A1:A10. Close the Properties window.

4
Test the macro

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.

Move the ComboBox list source to a helper range
Keep the source outside the hidden rows: Do not hide the helper range's rows with the macro. Avoid using On Error Resume Next as the primary fix because it can suppress other VBA errors.
Free Microsoft Office alternative

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.

Edit spreadsheet data and lists in a familiar interfaceOpen and save common Microsoft Excel formats, including XLSXMove everyday spreadsheet work to a lightweight Office suiteUse WPS Office free for common document tasks
QA img-9

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.