Excel: Hide Rows If Any Cell Is Blank in a Range
Blank cells within your data can interfere with calculations, charts, and reporting. If you want to clean up your worksheet by hiding any row that contains one or more blank cells, Excel offers multiple solutions—ranging from built-in tools to VBA automation. This guide walks you through the most effective methods.
Use Go To Special feature to hide rows with any blank cells
Use Kutools AI to hide rows with any blank cells
Use VBA code to hide rows with any blank cells
Use Go To Special feature to hide rows with any blank cells
With the Go To Special function, you can select the blank cells first and then apply the short cut keys to hide the rows which contain blank cells. Please do with following steps:
- Select the data range which contains the blank cells you want to hide.
- Then click Home > Find & Select > Go To Special. (You also can press Ctrl + G to open Go To dialog and click Special to get the Go To Special dialog.) See screenshot:
- And in the Go To Special dialog, select Blanks option, and then click OK button.
- All of the blank cells in the selection have been selected, see screenshot:
- Then you can press Ctrl + 9 keys together to hide the rows which have blank cells.
Use Kutools AI to hide rows with any blank cells
Kutools for Excel’s Kutools AI Aide combines the flexibility of Excel with the intelligence of an AI assistant. Unlike traditional methods that require formulas or VBA code, Kutools AI allows you to describe what you want to do in plain English—and it takes care of the rest.
- After installing Kutools for Excel, please click Kutools AI > AI Aide to open the Kutools AI Aide pane.
- Then, highlight the range of rows and columns you want to scan.
- In the Kutools AI input box, type a natural language command such as:
Hide rows if there are any blank cells in the selected range - Click Send or press Enter. Kutools AI will analyze your requirement, after analyzing, click Execute button, the rows contain blank cells are hidden at once.
Use VBA code to hide rows with any blank cells
The following vba code allows you to hide rows if any cell in a specified range is blank.
- Press Alt + F11 keys to display Microsoft Visual Basic for Applications window.
- Click Insert > Module, and paste below code to the new Module window.
Sub HideRowsWithAnyBlankCells() 'Updateby Extendoffice Dim ws As Worksheet Dim rng As Range, rowRange As Range Dim i As Long Set ws = ActiveSheet On Error Resume Next Set rng = Application.InputBox( _ Prompt:="Please select the range to check for blank cells:", _ Title:="KutoolsforExcel", _ Type:=8) On Error GoTo 0 If rng Is Nothing Then MsgBox "No range selected. Macro canceled.", vbExclamation Exit Sub End If Application.ScreenUpdating = False For i = 1 To rng.Rows.Count Set rowRange = rng.Rows(i) If Application.WorksheetFunction.CountBlank(rowRange) > 0 Then rowRange.EntireRow.Hidden = True End If Next i Application.ScreenUpdating = True MsgBox "Rows with any blank cells have been hidden.", vbInformation End Sub
- Press F5 key to run the code, a dialog pops out for you to select a range check the blank cells.
- Click OK. All rows in the selected range that contain at least one blank cell will be hidden.
🔚 Conclusion
Whether you're managing a small table or a large dataset, hiding rows with any blank cells can significantly improve data clarity and prevent errors in analysis. The method you choose depends on your needs and expertise:
- Use Go To Special for quick, manual review and selective hiding.
- Leverage Kutools AI for a smart, code-free solution using natural language commands.
- Apply VBA code for automated, repeatable row-hiding based on blanks.
Each method offers a unique advantage—choose the one that best fits your workflow for faster and cleaner data management in Excel. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials to help you master Excel.
Related articles:
How to shade or color blank cells in Excel?
How to select blank cells from a range in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!