Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in


How to select non-blank cells in a range in Excel?

Let’s say there are many nonadjacent blank cells existing in a range, and now you need to select all cells with content at present. How to easily select all non-blank cells in Excel easily? There are several tricks to solve it.

Select non-blank cells in a range with Go To Special feature

Select non-blank cells in a range with VBA

Select non-blank cells in a range with Kutools for Excel (only one step)

One click to select all nonblank cells in a range in Excel

Kutools for Excel’s Select Nonblank Cells utility can help you quickly select all nonblank cells from a selected range with only one click. Full Feature Free Trial 60-day!

ad select nonblank cells

The Go To Special feature can help us to select non-blank cells in a selected range with following steps.

1. Select the range you will select all non-blank cells from, and press F5 Key to open the Go To dialog box. Then click the Special button to open the Go To Special dialog box.

Note: You can also open the Go To Special dialog box directly with clicking the Home > Find & Select > Go To Special.

2. In the Go To Special dialog box, check the Constants option, Numbers option, Text option, Logicals option, and Errors option, and click the OK button.

Now you will see only non-blank cells with content are selected in the specified range. See below screenshots:

Here we provide a VBA macro for selecting all non-blank cells from a specified range. Please do as follows:

1. Press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click the Insert > Module, and then paste following VBA code into the opening module window.

VBA: Select non-blank cells from a range

Sub SelectNonBlankCells()
Dim Rng As Range
Dim OutRng As Range
Dim InputRng As Range
Dim xTitle As String
On Error Resume Next
xTitle = Application.ActiveWindow.RangeSelection.Address
Set InputRng = Application.InputBox("Range :", "KutoolsforExcel", xTitle, Type:=8)
Set InputRng = Application.Intersect(InputRng, Application.ActiveSheet.UsedRange)
For Each Rng In InputRng
If Not Rng.Value = "" Then
If OutRng Is Nothing Then
Set OutRng = Rng
Set OutRng = Application.Union(OutRng, Rng)
End If
End If
If Not (OutRng Is Nothing) Then
End If
End Sub

3. Press the F5 key or click the Run button to run this VBA.

4. In the opening dialog box, please specify the range that you will select non-blank cells only, and click the OK button.

Now all non-blank cells are selected in the specified range immediately.

Kutools for Excel’s Select Nonblank Cells utility enables you to select all non-blank cells from a certain range with just one click.

Kutools for Excel - Combines more than 300 Advanced Functions and Tools for Microsoft Excel

Select the range you will select non-blank cells only, and click the Kutools > Select > Select Nonblank Cells.

Now all non-blank cells in the specified range are selected at once.

Kutools for Excel - Includes more than 300 handy Excel tools. Full feature free trial 60-day, no credit card required! Get it now!

In this Video, the Kutools tab and the Kutools Plus tab are added by Kutools for Excel. If need it, please click here to have a 60-day free trial without limitation!

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    dash · 9 months ago
    Would you please show how this code can be modified so the range would be part of the code and wont need user input? like column B:B of a sheet named "List"?